feat: adds simple tests for internal exceptions
This commit is contained in:
@@ -19,6 +19,17 @@ class TestArrayTypeParser(TestCase):
|
||||
self.assertEqual(type_parsing.__origin__, list)
|
||||
self.assertEqual(element_type, str)
|
||||
|
||||
def test_array_parser_with_no_items(self):
|
||||
parser = ArrayTypeParser()
|
||||
|
||||
properties = {
|
||||
"default": ["a", "b", "c", "d"],
|
||||
"maxItems": 3,
|
||||
}
|
||||
|
||||
with self.assertRaises(InvalidSchemaException):
|
||||
parser.from_properties("placeholder", properties)
|
||||
|
||||
def test_array_parser_with_options_unique(self):
|
||||
parser = ArrayTypeParser()
|
||||
|
||||
|
||||
@@ -20,6 +20,17 @@ class TestOneOfTypeParser(TestCase):
|
||||
ref_cache={},
|
||||
)
|
||||
|
||||
with self.assertRaises(InvalidSchemaException):
|
||||
OneOfTypeParser().from_properties_impl(
|
||||
"test_field",
|
||||
{
|
||||
"oneOf": [], # should throw because oneOf must be a list with at least one item
|
||||
},
|
||||
required=True,
|
||||
context={},
|
||||
ref_cache={},
|
||||
)
|
||||
|
||||
with self.assertRaises(InvalidSchemaException):
|
||||
SchemaConverter.build(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user