test(protocol): parametrize temporal feature validator tests + float literals

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-11 16:58:08 +02:00
parent 3e9a4efcc2
commit 0e9489bf88
+14 -14
View File
@@ -153,19 +153,19 @@ def test_feature_unknown_column_fails() -> None:
validate_strategy(ast) validate_strategy(ast)
def test_validator_accepts_temporal_features() -> None: @pytest.mark.parametrize("name", ["hour", "dow", "is_weekend", "minute_of_hour"])
for name in ("hour", "dow", "is_weekend", "minute_of_hour"): def test_validator_accepts_temporal_feature(name: str) -> None:
src = _wrap( src = _wrap(
{ {
"op": "gt", "op": "gt",
"args": [ "args": [
{"kind": "feature", "name": name}, {"kind": "feature", "name": name},
{"kind": "literal", "value": 0}, {"kind": "literal", "value": 0.0},
], ],
} }
) )
ast = parse_strategy(src) ast = parse_strategy(src)
validate_strategy(ast) # no exception validate_strategy(ast) # no exception
def test_validator_rejects_temporal_typo() -> None: def test_validator_rejects_temporal_typo() -> None:
@@ -174,7 +174,7 @@ def test_validator_rejects_temporal_typo() -> None:
"op": "gt", "op": "gt",
"args": [ "args": [
{"kind": "feature", "name": "weekday"}, {"kind": "feature", "name": "weekday"},
{"kind": "literal", "value": 0}, {"kind": "literal", "value": 0.0},
], ],
} }
) )