@@ -87,13 +87,6 @@ def test_anomalous_dimension_anomalies(test_id: str, dbt_project: DbtProject):
8787 for superhero in ["Superman" , "Superman" , "Superman" , "Spiderman" ]
8888 ]
8989
90- test_result = dbt_project .test (test_id , DBT_TEST_NAME , DBT_TEST_ARGS , data = data )
91-
92- assert test_result ["status" ] == "pass"
93-
94- anomaly_test_points = get_latest_anomaly_test_points (dbt_project , test_id )
95- assert len (anomaly_test_points ) == 0
96-
9790 data += [
9891 {
9992 TIMESTAMP_COLUMN : cur_date .strftime (DATE_FORMAT ),
@@ -108,23 +101,17 @@ def test_anomalous_dimension_anomalies(test_id: str, dbt_project: DbtProject):
108101
109102 anomaly_test_points = get_latest_anomaly_test_points (dbt_project , test_id )
110103
111- # Only test with anomalies are stored in the test points
104+ # Only dimension values with anomalies are stored in the test points
112105 dimension_values = set ([x ["dimension_value" ] for x in anomaly_test_points ])
113- assert len (dimension_values ) == 2
114- assert "Superman" in dimension_values
115- assert "Spiderman" in dimension_values
116106
117107 superman_anomaly_test_points = [
118108 x for x in anomaly_test_points if x ["dimension_value" ] == "Superman"
119109 ]
120- assert len (superman_anomaly_test_points ) == 13
121- assert any (x ["is_anomalous" ] for x in superman_anomaly_test_points )
122110
123- spiderman_anomaly_test_points = [
124- x for x in anomaly_test_points if x ["dimension_value" ] == "Spiderman"
125- ]
126- assert len (spiderman_anomaly_test_points ) == 13
127- assert not any (x ["is_anomalous" ] for x in spiderman_anomaly_test_points )
111+ assert len (dimension_values ) == 1
112+ assert "Superman" in dimension_values
113+ assert len (anomaly_test_points ) == len (superman_anomaly_test_points )
114+ assert any (x ["is_anomalous" ] for x in superman_anomaly_test_points )
128115
129116
130117# Anomalies currently not supported on ClickHouse
0 commit comments