3
3
from eppo_metrics_sync .validation import unique_names , valid_fact_references , aggregation_is_valid
4
4
from eppo_metrics_sync .eppo_metrics_sync import EppoMetricsSync
5
5
6
- test_yaml_dir = "tests/yaml/dbt/invalid "
6
+ test_yaml_dir = "tests/yaml/dbt/"
7
7
8
8
9
9
def test_invalid_entity_tag ():
@@ -17,7 +17,7 @@ def test_invalid_entity_tag():
17
17
AssertionError ,
18
18
match = "Invalid entity tag eppo_entity:anonymous_user:foo in model revenue"
19
19
):
20
- eppo_metrics_sync .load_dbt_yaml (path = test_yaml_dir + "/invalid_entity_tag.yml" )
20
+ eppo_metrics_sync .load_dbt_yaml (path = test_yaml_dir + "invalid /invalid_entity_tag.yml" )
21
21
22
22
23
23
def test_missing_entity ():
@@ -31,7 +31,7 @@ def test_missing_entity():
31
31
ValueError ,
32
32
match = 'At least 1 column must have tag "eppo_entity:<entity_name>"'
33
33
):
34
- eppo_metrics_sync .load_dbt_yaml (path = test_yaml_dir + "/missing_entity.yml" )
34
+ eppo_metrics_sync .load_dbt_yaml (path = test_yaml_dir + "invalid /missing_entity.yml" )
35
35
36
36
37
37
def test_missing_timestamp ():
@@ -45,7 +45,7 @@ def test_missing_timestamp():
45
45
ValueError ,
46
46
match = 'Exactly 1 column must be have tag "eppo_timestamp"'
47
47
):
48
- eppo_metrics_sync .load_dbt_yaml (path = test_yaml_dir + "/missing_timestamp.yml" )
48
+ eppo_metrics_sync .load_dbt_yaml (path = test_yaml_dir + "invalid /missing_timestamp.yml" )
49
49
50
50
51
51
def test_overlapping_tags ():
@@ -59,14 +59,39 @@ def test_overlapping_tags():
59
59
ValueError ,
60
60
match = 'The following columns had tags to multiple Eppo fields: gross_revenue'
61
61
):
62
- eppo_metrics_sync .load_dbt_yaml (path = test_yaml_dir + "/overlapping_tags.yml" )
62
+ eppo_metrics_sync .load_dbt_yaml (path = test_yaml_dir + "invalid /overlapping_tags.yml" )
63
63
64
- # test that package handles yml without 'models' member gracefully
64
+
65
+ def test_model_is_not_a_dictionary ():
66
+
67
+ eppo_metrics_sync = EppoMetricsSync (
68
+ directory = None ,
69
+ schema_type = 'dbt-model' ,
70
+ dbt_model_prefix = 'foo'
71
+ )
72
+ with pytest .raises (
73
+ ValueError ,
74
+ match = 'Expected model to be a dictionary, got model = r'
75
+ ):
76
+ eppo_metrics_sync .load_dbt_yaml (path = test_yaml_dir + "invalid/model_is_not_a_dictionary.yml" )
77
+
78
+ # test that the package handles yml without 'models' member gracefully
79
+ def test_no_model_tag ():
80
+
81
+ eppo_metrics_sync = EppoMetricsSync (
82
+ directory = None ,
83
+ schema_type = 'dbt-model' ,
84
+ dbt_model_prefix = 'foo'
85
+ )
86
+ eppo_metrics_sync .load_dbt_yaml (path = test_yaml_dir + "valid/no_model_property.yml" )
87
+
88
+
89
+ # test that the package handles dbt models without eppo tags gracefully
65
90
def test_no_model_tag ():
66
91
67
92
eppo_metrics_sync = EppoMetricsSync (
68
93
directory = None ,
69
94
schema_type = 'dbt-model' ,
70
95
dbt_model_prefix = 'foo'
71
96
)
72
- eppo_metrics_sync .load_dbt_yaml (path = test_yaml_dir + "/no_model_tag .yml" )
97
+ eppo_metrics_sync .load_dbt_yaml (path = test_yaml_dir + "valid/no_dbt_tags .yml" )
0 commit comments