feat: improves test coverage
This commit is contained in:
@@ -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"],
|
||||
},
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user