feat: improves test coverage

This commit is contained in:
2025-11-23 02:42:54 -03:00
parent ebcc8a295e
commit c7e366cf08
2 changed files with 22 additions and 0 deletions

View File

@@ -310,3 +310,14 @@ class TestStringTypeParser(TestCase):
timedelta(seconds=0.5), 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"],
},
)

View File

@@ -20,3 +20,14 @@ class TestGenericTypeParser(TestCase):
def test_get_impl_invalid_type(self): def test_get_impl_invalid_type(self):
with self.assertRaises(InvalidSchemaException): with self.assertRaises(InvalidSchemaException):
GenericTypeParser._get_impl({"type": "invalid_type"}) 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)