tests: Reorder python version logic to be more clear.

This commit is contained in:
Chris Heald
2020-02-11 13:39:37 -07:00
committed by Tim Abbott
parent 3236483d0e
commit bddb370750

View File

@@ -346,12 +346,12 @@ so maybe we shouldn't mark it as intentionally undocumented in the urls.
E.g. typing.Union[typing.List[typing.Dict[str, typing.Any]], NoneType] E.g. typing.Union[typing.List[typing.Dict[str, typing.Any]], NoneType]
needs to be mapped to list.""" needs to be mapped to list."""
if sys.version_info < (3, 6) and type(t) is type(Union): # nocoverage # in python3.6+ if sys.version_info < (3, 7): # nocoverage # python 3.5-3.6
if sys.version_info < (3, 6) and type(t) is type(Union): # python 3.5 has special consideration for Union
origin = Union origin = Union
else: # nocoverage # in python3.5. I.E. this is used in python3.6+ else:
origin = getattr(t, "__origin__", None) origin = getattr(t, "__origin__", None)
else: # nocoverage # python3.7+
if sys.version_info > (3, 6): # nocoverage # in < python3.7
origin = getattr(t, "__origin__", None) origin = getattr(t, "__origin__", None)
t_name = getattr(t, "_name", None) t_name = getattr(t, "_name", None)
if origin == list: if origin == list: