Skip to content

Commit

Permalink
fixup! Adding extra test to cover both union types
Browse files Browse the repository at this point in the history
  • Loading branch information
gvangool committed Feb 23, 2023
1 parent 67eb802 commit f015a7f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions tests/test_openapi_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,9 @@ def method_union_payload_and_simple(request, data: Union[int, TypeB]):
if sys.version_info >= (3, 10):
# This requires Python 3.10 or higher (PEP 604), so we're using eval to
# conditionally make it available
exec(
"""
@api.post("/test-new-union-type", response=Response)
def method_new_union_payload(request, data: TypeA | TypeB):
return dict(i=data.i, f=data.f)
"""
)
@api.post("/test-new-union-type", response=Response)
def method_new_union_payload(request, data: "TypeA | TypeB"):
return dict(i=data.i, f=data.f)


@api.post(
Expand Down

0 comments on commit f015a7f

Please sign in to comment.