Skip to content

Commit 0eecf7d

Browse files
joostboonclaude
andcommitted
fix: black formatting and Vertica Decimal special-value handling
- Reformat anomalous_dimensions list to satisfy Black 88-char line limit - Fix TypeError in adapter_query_runner when Vertica returns Decimal special values (Infinity/NaN): as_tuple().exponent is a string ('F'/'n') for those cases, not an int, causing '>= not supported between str and int' Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 57ccbb0 commit 0eecf7d

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

integration_tests/tests/adapter_query_runner.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,14 @@ def _serialize_value(val: Any) -> Any:
5252
* Everything else is returned unchanged.
5353
"""
5454
if isinstance(val, Decimal):
55-
# Match the Jinja macro: normalize, then int or float
55+
# Match the Jinja macro: normalize, then int or float.
56+
# Note: for special values (Infinity, NaN), as_tuple().exponent is a
57+
# string ('F' or 'n'), not an int — convert those directly to float.
5658
normalized = val.normalize()
57-
if normalized.as_tuple().exponent >= 0:
59+
exponent = normalized.as_tuple().exponent
60+
if isinstance(exponent, str):
61+
return float(normalized)
62+
if exponent >= 0:
5863
return int(normalized)
5964
return float(normalized)
6065
if isinstance(val, (datetime, date, time)):

integration_tests/tests/test_dimension_anomalies.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,14 @@ def test_dimension_anomalies_alert_description_many_failures(
362362
test_date, *training_dates = generate_dates(base_date=utc_today - timedelta(1))
363363

364364
# 6 dimension values all spike on test_date (>5 threshold)
365-
anomalous_dimensions = ["Batman", "Superman", "Spiderman", "IronMan", "Thor", "Hulk"]
365+
anomalous_dimensions = [
366+
"Batman",
367+
"Superman",
368+
"Spiderman",
369+
"IronMan",
370+
"Thor",
371+
"Hulk",
372+
]
366373

367374
data: List[Dict[str, Any]] = [
368375
{TIMESTAMP_COLUMN: test_date.strftime(DATE_FORMAT), "superhero": hero}

0 commit comments

Comments
 (0)