test: annotate classifier controls and bind canonical resources

This commit is contained in:
haelyra committed 2026-10-11 16:35:54 -04:00
1 parent f6fe47de27
commit ba8595b43f
2 files changed
+10 -10

No files matched your search

@@ -10,7 +10,7 @@
"id": "hand-seeded",
"source": "manual-curation-pending-regeneration"
},
"registryDigest": "b21e33d7de6c1f8c1934a7b11d9cb9c5135abb5fd51c7db155eb393cff5fa959",
"registryDigest": "c86166ed37f558c3981a97c5f73bb08635b868e2e44e24dae8725f89ed9c3ff3",
"schemaVersion": 1,
"triggers": {
"skill:agent-runtime-gateway-smoke-test": [
+9 -9
View File
@@ -11,36 +11,36 @@ from scripts.parser import ComplianceSpec, Detector, ObservationEvent, Step
class TestParseClassification:
def test_plain_json(self):
def test_plain_json(self) -> None:
assert _parse_classification('{"a": [0, 2]}') == {"a": [0, 2]}
def test_fenced_json(self):
def test_fenced_json(self) -> None:
assert _parse_classification('```json\n{"a": [1]}\n```') == {"a": [1]}
def test_dict_without_list_values_is_empty(self):
def test_dict_without_list_values_is_empty(self) -> None:
assert _parse_classification('{"a": "x"}') == {}
def test_empty_object_is_valid(self):
def test_empty_object_is_valid(self) -> None:
assert _parse_classification("{}") == {}
def test_garbage_raises(self):
def test_garbage_raises(self) -> None:
with pytest.raises(classifier.ClassifierParseError, match="failed to parse"):
_parse_classification("sorry, I cannot classify these")
def test_non_dict_json_raises(self):
def test_non_dict_json_raises(self) -> None:
with pytest.raises(classifier.ClassifierParseError, match="non-dict"):
_parse_classification("[1, 2, 3]")
def test_non_integer_indices_raise(self):
def test_non_integer_indices_raise(self) -> None:
with pytest.raises(classifier.ClassifierParseError, match="failed to parse"):
_parse_classification('{"a": ["x"]}')
def test_is_runtime_error(self):
def test_is_runtime_error(self) -> None:
assert issubclass(classifier.ClassifierParseError, RuntimeError)
@pytest.mark.parametrize("response", ["not JSON", "[]", '{"a": ["x"]}'])
def test_grader_propagates_classifier_parse_failure(response):
def test_grader_propagates_classifier_parse_failure(response: str) -> None:
"""An invalid successful subprocess response cannot become a zero score."""
spec = ComplianceSpec(
id="fixture", name="Fixture", source_rule="fixture", version="1",