8000 fix tests and coverage for #1209 · ag-python/pydantic@5067508 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 5067508

Browse files
committed
fix tests and coverage for pydantic#1209
1 parent 881df8b commit 5067508

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tests/test_schema.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -967,13 +967,16 @@ class Foo(BaseModel):
967967
class Bar(BaseModel):
968968
pass
969969

970-
class Model_1(BaseModel):
971-
a: Union[Foo, Bar]
972-
973-
class Model_2(BaseModel):
974-
a: Union[Foo, Bar] = Field(...)
975-
976-
assert Model_1.schema()['properties'] == Model_2.schema()['properties']
970+
class Spam(BaseModel):
971+
a: Union[Foo, Bar] = Field(..., description='xxx')
972+
973+
assert Spam.schema()['properties'] == {
974+
'a': {
975+
'title': 'A',
976+
'description': 'xxx',
977+
'anyOf': [{'$ref': '#/definitions/Foo'}, {'$ref': '#/definitions/Bar'}],
978+
},
979+
}
977980

978981

979982
def test_schema_from_models():

0 commit comments

Comments
 (0)
0