aboutsummaryrefslogtreecommitdiff
path: root/tests/serialize/errors.test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/serialize/errors.test.py')
-rw-r--r--tests/serialize/errors.test.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/serialize/errors.test.py b/tests/serialize/errors.test.py
index 1b7dd39..cc5ec30 100644
--- a/tests/serialize/errors.test.py
+++ b/tests/serialize/errors.test.py
@@ -11,6 +11,7 @@ from edify.errors.serialize import (
NonObjectJSONPayloadError,
UnknownElementKindError,
)
+from edify.serialize import JSONValue
def test_missing_edify_key_raises():
@@ -24,7 +25,7 @@ def test_missing_pattern_key_raises():
def test_missing_kind_on_nested_node_raises():
- document = {
+ document: dict[str, JSONValue] = {
"edify": 0,
"pattern": {"kind": "root", "children": [{"value": "x"}]},
}
@@ -33,13 +34,13 @@ def test_missing_kind_on_nested_node_raises():
def test_incompatible_schema_version_raises():
- document = {"edify": 999, "pattern": {"kind": "root", "children": []}}
+ document: dict[str, JSONValue] = {"edify": 999, "pattern": {"kind": "root", "children": []}}
with pytest.raises(IncompatibleSchemaVersionError):
Pattern.from_dict(document)
def test_unknown_kind_raises():
- document = {
+ document: dict[str, JSONValue] = {
"edify": 0,
"pattern": {"kind": "root", "children": [{"kind": "mystery"}]},
}
@@ -58,12 +59,15 @@ def test_non_object_json_payload_raises_non_object_json_payload_error():
def test_incompatible_schema_version_with_composite_value_stringifies_it():
- document = {"edify": [1, 2, 3], "pattern": {"kind": "root", "children": []}}
+ document: dict[str, JSONValue] = {
+ "edify": [1, 2, 3],
+ "pattern": {"kind": "root", "children": []},
+ }
with pytest.raises(IncompatibleSchemaVersionError):
Pattern.from_dict(document)
def test_pattern_key_not_a_root_element_produces_empty_pattern():
- document = {"edify": 0, "pattern": {"kind": "digit"}}
+ document: dict[str, JSONValue] = {"edify": 0, "pattern": {"kind": "digit"}}
restored = Pattern.from_dict(document)
assert restored.to_regex_string() == "(?:)"