8000 Update test_typing_extensions.py (#773) · python/typing@c7a981a · GitHub
[go: up one dir, main page]

Skip to content

Commit c7a981a

Browse files
Update test_typing_extensions.py (#773)
1 parent b5c0b6d commit c7a981a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

typing_extensions/src_py3/test_typing_extensions.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
TYPING_3_5_1 = TYPING_LATEST or sys.version_info[:3] >= (3, 5, 1)
5252
TYPING_3_5_3 = TYPING_LATEST or sys.version_info[:3] >= (3, 5, 3)
5353
TYPING_3_6_1 = TYPING_LATEST or sys.version_info[:3] >= (3, 6, 1)
54+
TYPING_3_10_0 = TYPING_LATEST or sys.version_info[:3] >= (3, 10, 0)
5455

5556
# For typing versions where issubclass(...) and
5657
# isinstance(...) checks are forbidden.
@@ -1240,8 +1241,9 @@ class P(PR[int, str], Protocol):
12401241
self.assertIsSubclass(P, PR)
12411242
with self.assertRaises(TypeError):
12421243
PR[int]
1243-
with self.assertRaises(TypeError):
1244-
PR[int, 1]
1244+
if not TYPING_3_10_0:
1245+
with self.assertRaises(TypeError):
1246+
PR[int, 1]
12451247
class P1(Protocol, Generic[T]):
12461248
def bar(self, x: T) -> str: ...
12471249
class P2(Generic[T], Protocol):
@@ -1254,7 +1256,7 @@ class Test:
12541256
def bar(self, x: str) -> str:
12551257
return x
12561258
self.assertIsInstance(Test(), PSub)
1257-
if TYPING_3_5_3:
1259+
if TYPING_3_5_3 and not TYPING_3_10_0:
12581260
with self.assertRaises(TypeError):
12591261
PR[int, ClassVar]
12601262

0 commit comments

Comments
 (0)
0