Skip to content

Commit

Permalink
Correct error message for 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Daraan committed Oct 2, 2024
1 parent 5bc1360 commit 3ae9e35
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/test_typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7307,9 +7307,15 @@ def test_getitem(self):
subscripted = ListOrSetT[int]
self.assertEqual(get_args(subscripted), (int,))
self.assertIs(get_origin(subscripted), ListOrSetT)
with self.assertRaises(TypeError, msg="not a generic class"):
with self.assertRaisesRegex(TypeError,
"not a generic class"
# types.GenericAlias raises a different error in 3.10
if sys.version_info[:2] != (3, 10)
else "There are no type variables left in ListOrSetT"
):
subscripted[int]


still_generic = ListOrSetT[Iterable[T]]
self.assertEqual(get_args(still_generic), (Iterable[T],))
self.assertIs(get_origin(still_generic), ListOrSetT)
Expand Down

0 comments on commit 3ae9e35

Please sign in to comment.