Skip to content

Commit e94a6c5

Browse files
committed
fix tests
1 parent 9374977 commit e94a6c5

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

integration_tests/tests/test_dimension_anomalies.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,24 @@ def test_anomalous_dimension_anomalies(test_id: str, dbt_project: DbtProject):
100100

101101
# Dimension anomalies only stores anomalous rows (unlike other anomaly tests) - so we should only get 1 row with the problematic value
102102
anomaly_test_points = get_latest_anomaly_test_points(dbt_project, test_id)
103-
assert len(anomaly_test_points) == 1
104-
assert anomaly_test_points[0]["is_anomalous"]
105-
assert anomaly_test_points[0]["dimension"] == "superhero"
106-
assert anomaly_test_points[0]["dimension_value"] == "Superman"
103+
104+
# Only dimension values that are anomalous are stored in the test points
105+
dimension_values = set([x["dimension_value"] for x in anomaly_test_points])
106+
assert len(dimension_values) == 2
107+
assert "Superman" in dimension_values
108+
assert "Spiderman" in dimension_values
109+
110+
superman_anomaly_test_points = [
111+
x for x in anomaly_test_points if x["dimension_value"] == "Superman"
112+
]
113+
assert len(superman_anomaly_test_points) == 13
114+
assert any(x["is_anomalous"] for x in superman_anomaly_test_points)
115+
116+
spiderman_anomaly_test_points = [
117+
x for x in anomaly_test_points if x["dimension_value"] == "Spiderman"
118+
]
119+
assert len(spiderman_anomaly_test_points) == 13
120+
assert any(x["is_anomalous"] for x in spiderman_anomaly_test_points)
107121

108122

109123
# Anomalies currently not supported on ClickHouse

0 commit comments

Comments
 (0)