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)