feat: adds simple tests for internal exceptions

This commit is contained in:
2025-09-14 00:57:36 -03:00
parent e31002af32
commit 8c6a04bbdf
6 changed files with 118 additions and 0 deletions

View File

@@ -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()

View File

@@ -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(
{