Skip to content

Commit

Permalink
Added test back
Browse files Browse the repository at this point in the history
  • Loading branch information
DevonFulcher committed Oct 7, 2024
1 parent 525e1b1 commit 4892e3b
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions tests/validations/test_time_spines.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 4892e3b

Please sign in to comment.