Fix union type hint checks (#318)

Fix some obscure edge cases related to typing.Union type args.

Fixes #304.
This commit is contained in:
Roman Sichny
2019-02-22 01:00:14 +02:00
committed by Cristi Vîjdea
parent 3d43ee6748
commit 76c8fe0646
2 changed files with 22 additions and 4 deletions
@@ -33,6 +33,10 @@ if typing:
# Following cases are not 100% correct, but it should work somehow and not crash.
(Union[int, float], None),
(List, {'type': openapi.TYPE_ARRAY, 'items': openapi.Items(openapi.TYPE_STRING)}),
('SomeType', None),
(type('SomeType', (object,), {}), None),
(None, None),
(6, None),
])
def test_get_basic_type_info_from_hint(hint_class, expected_swagger_type_info):
type_info = get_basic_type_info_from_hint(hint_class)