51
51
TYPING_3_5_1 = TYPING_LATEST or sys .version_info [:3 ] >= (3 , 5 , 1 )
52
52
TYPING_3_5_3 = TYPING_LATEST or sys .version_info [:3 ] >= (3 , 5 , 3 )
53
53
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 )
54
55
55
56
# For typing versions where issubclass(...) and
56
57
# isinstance(...) checks are forbidden.
@@ -1240,8 +1241,9 @@ class P(PR[int, str], Protocol):
1240
1241
self .assertIsSubclass (P , PR )
1241
1242
with self .assertRaises (TypeError ):
1242
1243
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 ]
1245
1247
class P1 (Protocol , Generic [T ]):
1246
1248
def bar (self , x : T ) -> str : ...
1247
1249
class P2 (Generic [T ], Protocol ):
@@ -1254,7 +1256,7 @@ class Test:
1254
1256
def bar (self , x : str ) -> str :
1255
1257
return x
1256
1258
self .assertIsInstance (Test (), PSub )
1257
- if TYPING_3_5_3 :
1259
+ if TYPING_3_5_3 and not TYPING_3_10_0 :
1258
1260
with self .assertRaises (TypeError ):
1259
1261
PR [int , ClassVar ]
1260
1262
0 commit comments