From 4cd36b4a2b0f31d676d5db0ef5cc5939dd384f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Thu, 3 Jul 2025 15:55:41 +0200 Subject: [PATCH] tests: adds test for exception serialization --- tests/utils/serialization/test_serializer.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/utils/serialization/test_serializer.py b/tests/utils/serialization/test_serializer.py index f0d8b53..97ed228 100644 --- a/tests/utils/serialization/test_serializer.py +++ b/tests/utils/serialization/test_serializer.py @@ -1225,3 +1225,22 @@ def test_add_prefix_to_full_access_path( serialized_obj: SerializedObject, prefix: str, expected: SerializedObject ) -> None: assert add_prefix_to_full_access_path(serialized_obj, prefix) == expected + + +def test_serialize_exception() -> None: + assert dump(Exception()) == { + "doc": None, + "full_access_path": "", + "name": "Exception", + "readonly": True, + "type": "Exception", + "value": "", + } + assert dump(Exception("Exception message")) == { + "doc": None, + "full_access_path": "", + "name": "Exception", + "readonly": True, + "type": "Exception", + "value": "Exception message", + }