From c7e366cf08526b5c88e98ecbc4f0dc7e68ccd0fb Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Sun, 23 Nov 2025 02:42:54 -0300 Subject: [PATCH] feat: improves test coverage --- tests/parser/test_string_type_parser.py | 11 +++++++++++ tests/parser/test_type_parser.py | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/tests/parser/test_string_type_parser.py b/tests/parser/test_string_type_parser.py index eb8de81..0971588 100644 --- a/tests/parser/test_string_type_parser.py +++ b/tests/parser/test_string_type_parser.py @@ -310,3 +310,14 @@ class TestStringTypeParser(TestCase): timedelta(seconds=0.5), ], ) + + def test_string_parser_with_invalid_example_value(self): + with self.assertRaises(InvalidSchemaException): + StringTypeParser().from_properties( + "placeholder", + { + "type": "string", + "format": "email", + "examples": ["invalid-email"], + }, + ) diff --git a/tests/parser/test_type_parser.py b/tests/parser/test_type_parser.py index 748ea7e..0871867 100644 --- a/tests/parser/test_type_parser.py +++ b/tests/parser/test_type_parser.py @@ -20,3 +20,14 @@ class TestGenericTypeParser(TestCase): def test_get_impl_invalid_type(self): with self.assertRaises(InvalidSchemaException): GenericTypeParser._get_impl({"type": "invalid_type"}) + + def test_invalid_examples_not_list(self): + parser = StringTypeParser() + + properties = { + "type": "integer", + "examples": "this should be a list", + } + + with self.assertRaises(InvalidSchemaException): + parser.from_properties("placeholder", properties)