AnyUnmarshaller use allOf schemas test

This commit is contained in:
p1c2u 2021-02-09 21:37:36 +00:00
parent 95af36994e
commit c40bd4d0e4
2 changed files with 18 additions and 0 deletions

View file

@ -329,6 +329,7 @@ components:
message:
type: string
ExtendedError:
type: object
x-model: ExtendedError
allOf:
- $ref: "#/components/schemas/Error"

View file

@ -466,6 +466,23 @@ class TestSchemaUnmarshallerCall(object):
])
assert unmarshaller_factory(schema)(['hello']) == ['hello']
def test_schema_any_all_of(self, unmarshaller_factory):
schema = Schema(all_of=[
Schema('array', items=Schema('string')),
])
assert unmarshaller_factory(schema)(['hello']) == ['hello']
def test_schema_any_all_of_any(self, unmarshaller_factory):
schema = Schema(all_of=[
Schema(),
Schema('string', schema_format='date'),
])
value = '2018-01-02'
result = unmarshaller_factory(schema)(value)
assert result == datetime.date(2018, 1, 2)
def test_schema_any(self, unmarshaller_factory):
schema = Schema()
assert unmarshaller_factory(schema)('string') == 'string'