8000 Make tests for Annotated work with Python 3.9 (#731) · python/typing@8c78fa7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8c78fa7

Browse files
authored
Make tests for Annotated work with Python 3.9 (#731)
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.
1 parent d7d8b3d commit 8c78fa7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

typing_extensions/src_py3/test_typing_extensions.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,13 +1588,17 @@ def test_keys_inheritance(self):
15881588
class AnnotatedTests(BaseTestCase):
15891589

15901590
def test_repr(self):
1591+
if hasattr(typing, 'Annotated'):
1592+
mod_name = 'typing'
1593+
else:
1594+
mod_name = "typing_extensions"
15911595
self.assertEqual(
15921596
repr(Annotated[int, 4, 5]),
1593-
"typing_extensions.Annotated[int, 4, 5]"
1597+
mod_name + ".Annotated[int, 4, 5]"
15941598
)
15951599
self.assertEqual(
15961600
repr(Annotated[List[int], 4, 5]),
1597-
"typing_extensions.Annotated[typing.List[int], 4, 5]"
1601+
mod_name + ".Annotated[typing.List[int], 4, 5]"
15981602
)
15991603

16001604
def test_flatten(self):

0 commit comments

Comments
 (0)
0