Skip to content

Commit

Permalink
tests for meta field
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamDee committed Feb 27, 2024
1 parent 1741038 commit 721c321
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/parsing/test_metric_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def test_base_metric_parsing() -> None:
type: {metric_type.value}
description: {description}
label: {label}
meta:
random: metadata
type_params:
measure:
name: metadata_test_measure
Expand Down
3 changes: 3 additions & 0 deletions tests/parsing/test_semantic_model_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def test_base_semantic_model_parsing() -> None:
node_relation:
alias: source_table
schema_name: some_schema
config:
meta:
test_metadata: random
"""
)
file = YamlConfigFile(filepath="test_dir/inline_for_test", contents=yaml_contents)
Expand Down
13 changes: 12 additions & 1 deletion tests/test_implements_satisfy_protocols.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
from typing import List, Protocol, runtime_checkable

from hypothesis import given
from hypothesis.strategies import booleans, builds, from_type, just, lists, none, text
from hypothesis.strategies import (
booleans,
builds,
dictionaries,
from_type,
just,
lists,
none,
text,
)

from dbt_semantic_interfaces.implementations.elements.dimension import (
PydanticDimension,
Expand Down Expand Up @@ -54,6 +63,7 @@

OPTIONAL_STR_STRATEGY = text() | none()
OPTIONAL_METADATA_STRATEGY = builds(PydanticMetadata) | none()
META_STRATEGY = dictionaries(text(), text())

CATEGORICAL_DIMENSION_STRATEGY = builds(
PydanticDimension,
Expand Down Expand Up @@ -117,6 +127,7 @@
filter=builds(PydanticWhereFilter) | none(),
metadata=OPTIONAL_METADATA_STRATEGY,
label=OPTIONAL_STR_STRATEGY,
meta=META_STRATEGY,
)

SAVED_QUERY_STRATEGY = builds(
Expand Down

0 comments on commit 721c321

Please sign in to comment.