feat(protocol): extend KNOWN_FEATURES with temporal feature names

This commit is contained in:
2026-05-11 16:56:36 +02:00
parent 30dbba4d74
commit 3e9a4efcc2
2 changed files with 32 additions and 1 deletions
+30
View File
@@ -151,3 +151,33 @@ def test_feature_unknown_column_fails() -> None:
ast = parse_strategy(src)
with pytest.raises(ValidationError, match="unknown feature"):
validate_strategy(ast)
def test_validator_accepts_temporal_features() -> None:
for name in ("hour", "dow", "is_weekend", "minute_of_hour"):
src = _wrap(
{
"op": "gt",
"args": [
{"kind": "feature", "name": name},
{"kind": "literal", "value": 0},
],
}
)
ast = parse_strategy(src)
validate_strategy(ast) # no exception
def test_validator_rejects_temporal_typo() -> None:
src = _wrap(
{
"op": "gt",
"args": [
{"kind": "feature", "name": "weekday"},
{"kind": "literal", "value": 0},
],
}
)
ast = parse_strategy(src)
with pytest.raises(ValidationError, match="unknown feature"):
validate_strategy(ast)