Better Object Internal Structure and Type Selection
This commit is contained in:
@@ -24,20 +24,6 @@ class TestSchemaConverter(TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
SchemaConverter.build(schema)
|
||||
|
||||
def test_build_expects_valid_schema(self):
|
||||
invalid_schema = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "strng"
|
||||
} # typo: "strng" is not a valid JSON Schema type
|
||||
},
|
||||
"required": ["name"],
|
||||
}
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
SchemaConverter.build_object("placeholder", invalid_schema)
|
||||
|
||||
def test_build_expects_object(self):
|
||||
schema = {
|
||||
"title": "Person",
|
||||
@@ -61,8 +47,9 @@ class TestSchemaConverter(TestCase):
|
||||
# 'required': ['name', 'age', 'is_active', 'friends', 'address'],
|
||||
}
|
||||
|
||||
with self.assertRaises(ValueError):
|
||||
with self.assertRaises(ValueError) as context:
|
||||
SchemaConverter.build(schema)
|
||||
self.assertTrue("Unknown type" in str(context.exception))
|
||||
|
||||
def test_jsonschema_to_pydantic(self):
|
||||
schema = {
|
||||
|
||||
Reference in New Issue
Block a user