From 0afdd16326b31083e74a4f6956e84f5ad2de37aa Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Wed, 27 May 2026 11:27:46 +1200 Subject: [PATCH] test: verify NodeTypeError is catchable as PatchError and TypeError --- tests/test_errors.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_errors.py b/tests/test_errors.py index ec3df30..be29aed 100644 --- a/tests/test_errors.py +++ b/tests/test_errors.py @@ -36,6 +36,16 @@ def test_node_type_error_inherits_patch_error_and_type_error(self): assert issubclass(NodeTypeError, PatchError) assert issubclass(NodeTypeError, TypeError) + def test_node_type_error_catchable_as_patch_error(self): + msg = "not a list" + with pytest.raises(PatchError): + raise NodeTypeError(msg) + + def test_node_type_error_catchable_as_type_error(self): + msg = "not a list" + with pytest.raises(TypeError): + raise NodeTypeError(msg) + def test_raise_and_catch_base(self): msg = "key already exists" with pytest.raises(YAMLTripError, match=msg):