From 4892e3bc774ae285766befa3ad3df007c66cbb76 Mon Sep 17 00:00:00 2001 From: Devon Fulcher <24593113+DevonFulcher@users.noreply.github.com> Date: Mon, 7 Oct 2024 16:33:09 -0500 Subject: [PATCH] Added test back --- tests/validations/test_time_spines.py | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/validations/test_time_spines.py b/tests/validations/test_time_spines.py index 7c0098d2..70beba35 100644 --- a/tests/validations/test_time_spines.py +++ b/tests/validations/test_time_spines.py @@ -21,6 +21,9 @@ PydanticTimeSpineCustomGranularityColumn, PydanticTimeSpinePrimaryColumn, ) +from dbt_semantic_interfaces.implementations.time_spine_table_configuration import ( + PydanticTimeSpineTableConfiguration, +) from dbt_semantic_interfaces.test_utils import semantic_model_with_guaranteed_meta from dbt_semantic_interfaces.type_enums import ( AggregationType, @@ -74,6 +77,56 @@ def test_valid_time_spines() -> None: # noqa: D SemanticManifestValidator[PydanticSemanticManifest]().checked_validations(semantic_manifest) +def test_no_warning_for_legacy_time_spine() -> None: # noqa: D + validator = SemanticManifestValidator[PydanticSemanticManifest]() + semantic_manifest = PydanticSemanticManifest( + semantic_models=[ + semantic_model_with_guaranteed_meta( + name="sum_measure", + measures=[ + PydanticMeasure( + name="foo", + agg=AggregationType.SUM, + agg_time_dimension="dim", + create_metric=True, + description="", + agg_params=None, + metadata=None, + ) + ], + dimensions=[ + PydanticDimension( + name="dim", + type=DimensionType.TIME, + type_params=PydanticDimensionTypeParams(time_granularity=TimeGranularity.SECOND), + description="", + metadata=None, + ) + ], + entities=[ + PydanticEntity(name="entity", type=EntityType.PRIMARY, description="", role=None, metadata=None) + ], + ), + ], + metrics=[], + project_configuration=PydanticProjectConfiguration( + time_spine_table_configurations=[ + PydanticTimeSpineTableConfiguration(location="baz", column_name="fun_col", grain=TimeGranularity.DAY) + ], + time_spines=[ + PydanticTimeSpine( + node_relation=PydanticNodeRelation(alias="time_spine", schema_name="schema"), + primary_column=PydanticTimeSpinePrimaryColumn(name="ds", time_granularity=TimeGranularity.SECOND), + custom_granularities=[], + ) + ], + ), + ) + issues = validator.validate_semantic_manifest(semantic_manifest) + assert not issues.has_blocking_issues + assert len(issues.warnings) == 0 + + def test_duplicate_time_spine_granularity() -> None: # noqa: D validator = SemanticManifestValidator[PydanticSemanticManifest]() semantic_manifest = PydanticSemanticManifest(