diff options
| author | natsuoto <[email protected]> | 2026-07-15 11:35:47 +0530 |
|---|---|---|
| committer | natsuoto <[email protected]> | 2026-07-15 11:35:47 +0530 |
| commit | 7d914f6a7231b5997035cf3459aa0e3e6740064a (patch) | |
| tree | e0067922015ed594168f4b8bf133eb73e8fe27d5 /tests/serialize/errors.test.py | |
| parent | 55967f72d643d19e9749f1a22b4563b7cb5f149e (diff) | |
| download | edify-7d914f6a7231b5997035cf3459aa0e3e6740064a.tar.xz edify-7d914f6a7231b5997035cf3459aa0e3e6740064a.zip | |
refactor(serialize): precise JSONValue types replace Any; hoist imports; drop docstring from __init__
Diffstat (limited to 'tests/serialize/errors.test.py')
| -rw-r--r-- | tests/serialize/errors.test.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/serialize/errors.test.py b/tests/serialize/errors.test.py index ff6371f..68adaac 100644 --- a/tests/serialize/errors.test.py +++ b/tests/serialize/errors.test.py @@ -49,3 +49,14 @@ def test_unknown_kind_raises(): def test_bad_json_string_raises_decode_error(): with pytest.raises(json.JSONDecodeError): Pattern.from_json("{not-valid-json}") + + +def test_non_object_json_payload_raises_type_error(): + with pytest.raises(TypeError, match="canonical JSON payload must be an object"): + Pattern.from_json("[1, 2, 3]") + + +def test_pattern_key_not_a_root_element_produces_empty_pattern(): + document = {"edify": 0, "pattern": {"kind": "digit"}} + restored = Pattern.from_dict(document) + assert restored.to_regex_string() == "(?:)" |
