Skip to content

Commit

Permalink
Make tests for Annotated work with Python 3.9 (#731)
Browse files Browse the repository at this point in the history
Python 3.9+ has its own version of Annotated. Make the tests take it
into account similarly to how this is done for other backported
typing constructs.
  • Loading branch information
east825 authored Jun 8, 2020
1 parent d7d8b3d commit 8c78fa7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions typing_extensions/src_py3/test_typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1588,13 +1588,17 @@ def test_keys_inheritance(self):
class AnnotatedTests(BaseTestCase):

def test_repr(self):
if hasattr(typing, 'Annotated'):
mod_name = 'typing'
else:
mod_name = "typing_extensions"
self.assertEqual(
repr(Annotated[int, 4, 5]),
"typing_extensions.Annotated[int, 4, 5]"
mod_name + ".Annotated[int, 4, 5]"
)
self.assertEqual(
repr(Annotated[List[int], 4, 5]),
"typing_extensions.Annotated[typing.List[int], 4, 5]"
mod_name + ".Annotated[typing.List[int], 4, 5]"
)

def test_flatten(self):
Expand Down

0 comments on commit 8c78fa7

Please sign in to comment.