@@ -183,7 +183,7 @@ def test_cannot_subclass(self):
183183 class A (self .bottom_type ):
184184 pass
185185 with self .assertRaises (TypeError ):
186- class A (type (self .bottom_type )):
186+ class B (type (self .bottom_type )):
187187 pass
188188
189189 def test_cannot_instantiate (self ):
@@ -279,7 +279,7 @@ def test_cannot_subclass(self):
279279 class C (type (Self )):
280280 pass
281281 with self .assertRaises (TypeError ):
282- class C (Self ):
282+ class D (Self ):
283283 pass
284284
285285 def test_cannot_init (self ):
@@ -335,7 +335,7 @@ def test_cannot_subclass(self):
335335 class C (type (LiteralString )):
336336 pass
337337 with self .assertRaises (TypeError ):
338- class C (LiteralString ):
338+ class D (LiteralString ):
339339 pass
340340
341341 def test_cannot_init (self ):
@@ -457,7 +457,7 @@ class V(TypeVar('T')):
457457
458458 def test_cannot_subclass_var_itself (self ):
459459 with self .assertRaises (TypeError ):
460- class V (TypeVar ):
460+ class W (TypeVar ):
461461 pass
462462
463463 def test_cannot_instantiate_vars (self ):
@@ -1185,20 +1185,20 @@ class C(TypeVarTuple): pass
11851185 def test_cannot_subclass_instance (self ):
11861186 Ts = TypeVarTuple ('Ts' )
11871187 with self .assertRaises (TypeError ):
1188- class C (Ts ): pass
1188+ class D (Ts ): pass
11891189 with self .assertRaisesRegex (TypeError , CANNOT_SUBCLASS_TYPE ):
1190- class C (type (Unpack )): pass
1190+ class E (type (Unpack )): pass
11911191 with self .assertRaisesRegex (TypeError , CANNOT_SUBCLASS_TYPE ):
1192- class C (type (* Ts )): pass
1192+ class F (type (* Ts )): pass
11931193 with self .assertRaisesRegex (TypeError , CANNOT_SUBCLASS_TYPE ):
1194- class C (type (Unpack [Ts ])): pass
1194+ class G (type (Unpack [Ts ])): pass
11951195 with self .assertRaisesRegex (TypeError ,
11961196 r'Cannot subclass typing\.Unpack' ):
1197- class C (Unpack ): pass
1197+ class H (Unpack ): pass
11981198 with self .assertRaisesRegex (TypeError , r'Cannot subclass \*Ts' ):
1199- class C (* Ts ): pass
1199+ class I (* Ts ): pass
12001200 with self .assertRaisesRegex (TypeError , r'Cannot subclass \*Ts' ):
1201- class C (Unpack [Ts ]): pass
1201+ class J (Unpack [Ts ]): pass
12021202
12031203 def test_variadic_class_args_are_correct (self ):
12041204 T = TypeVar ('T' )
@@ -1372,12 +1372,12 @@ def test_variadic_class_with_duplicate_typevartuples_fails(self):
13721372 with self .assertRaises (TypeError ):
13731373 class C (Generic [* Ts1 , * Ts1 ]): pass
13741374 with self .assertRaises (TypeError ):
1375- class C (Generic [Unpack [Ts1 ], Unpack [Ts1 ]]): pass
1375+ class D (Generic [Unpack [Ts1 ], Unpack [Ts1 ]]): pass
13761376
13771377 with self .assertRaises (TypeError ):
1378- class C (Generic [* Ts1 , * Ts2 , * Ts1 ]): pass
1378+ class E (Generic [* Ts1 , * Ts2 , * Ts1 ]): pass
13791379 with self .assertRaises (TypeError ):
1380- class C (Generic [Unpack [Ts1 ], Unpack [Ts2 ], Unpack [Ts1 ]]): pass
1380+ class F (Generic [Unpack [Ts1 ], Unpack [Ts2 ], Unpack [Ts1 ]]): pass
13811381
13821382 def test_type_concatenation_in_variadic_class_argument_list_succeeds (self ):
13831383 Ts = TypeVarTuple ('Ts' )
@@ -1744,10 +1744,10 @@ def test_cannot_subclass(self):
17441744 class C (Union ):
17451745 pass
17461746 with self .assertRaises (TypeError ):
1747- class C (type (Union )):
1747+ class D (type (Union )):
17481748 pass
17491749 with self .assertRaises (TypeError ):
1750- class C (Union [int , str ]):
1750+ class<
4D1C
/span> E (Union [int , str ]):
17511751 pass
17521752
17531753 def test_cannot_instantiate (self ):
@@ -2454,10 +2454,10 @@ class BP(Protocol): pass
24542454 class P (C , Protocol ):
24552455 pass
24562456 with self .assertRaises (TypeError ):
2457- class P (Protocol , C ):
2457+ class Q (Protocol , C ):
24582458 pass
24592459 with self .assertRaises (TypeError ):
2460- class P (BP , C , Protocol ):
2460+ class R (BP , C , P
BEA4
rotocol ):
24612461 pass
24622462
24632463 class D (BP , C ): pass
@@ -2722,7 +2722,7 @@ class NotAProtocolButAnImplicitSubclass3:
27222722 meth : Callable [[], None ]
27232723 meth2 : Callable [[int , str ], bool ]
27242724 def meth (self ): pass
2725- def meth (self , x , y ): return True
2725+ def meth2 (self , x , y ): return True
27262726
27272727 self .assertNotIsSubclass (AnnotatedButNotAProtocol , CallableMembersProto )
27282728 self .assertIsSubclass (NotAProtocolButAnImplicitSubclass , CallableMembersProto )
@@ -3208,11 +3208,11 @@ def test_protocols_bad_subscripts(self):
32083208 with self .assertRaises (TypeError ):
32093209 class P (Protocol [T , T ]): pass
32103210 with self .assertRaises (TypeError ):
3211- class P (Protocol [int ]): pass
3211+ class Q (Protocol [int ]): pass
32123212 with self .assertRaises (TypeError ):
3213- class P (Protocol [T ], Protocol [S ]): pass
3213+ class R (Protocol [T ], Protocol [S ]): pass
32143214 with self .assertRaises (TypeError ):
3215- class P (typing .Mapping [T , S ], Protocol [T ]): pass
3215+ class S (typing .Mapping [T , S ], Protocol [T ]): pass
32163216
32173217 def test_generic_protocols_repr (self ):
32183218 T = TypeVar ('T' )
@@ -3553,12 +3553,12 @@ class NewGeneric(Generic): ...
35533553 with self .assertRaises (TypeError ):
35543554 class MyGeneric (Generic [T ], Generic [S ]): ...
35553555 with self .assertRaises (TypeError ):
3556- class MyGeneric (List [T ], Generic [S ]): ...
3556+ class MyGeneric2 (List [T ], Generic [S ]): ...
35573557 with self .assertRaises (TypeError ):
35583558 Generic [()]
3559- class C (Generic [T ]): pass
3559+ class D (Generic [T ]): pass
35603560 with self .assertRaises (TypeError ):
3561- C [()]
3561+ D [()]
35623562
35633563 def test_init (self ):
35643564 T = TypeVar ('T' )
@@ -4234,7 +4234,7 @@ class Test(Generic[T], Final):
42344234 class Subclass (Test ):
42354235 pass
42364236 with self .assertRaises (FinalException ):
4237- class Subclass (Test [int ]):
4237+ class Subclass2 (Test [int ]):
42384238 pass
42394239
42404240 def test_nested (self ):
@@ -4472,7 +4472,7 @@ def test_cannot_subclass(self):
44724472 class C (type (ClassVar )):
44734473 pass
44744474 with self .assertRaises (TypeError ):
4475- class C (type (ClassVar [int ])):
4475+ class D (type (ClassVar [int ])):
44764476 pass
44774477
44784478 def test_cannot_init (self ):
@@ -4514,7 +4514,7 @@ def test_cannot_subclass(self):
45144514 class C (type (Final )):
45154515 pass
45164516 with self .assertRaises (TypeError ):
4517- class C (type (Final [int ])):
4517+ class D (type (Final [int ])):
45184518 pass
45194519
45204520 def test_cannot_init (self ):
@@ -6514,15 +6514,15 @@ class A:
65146514 class X (NamedTuple , A ):
65156515 x : int
65166516 with self .assertRaises (TypeError ):
6517- class X (NamedTuple , tuple ):
6517+ class Y (NamedTuple , tuple )
4D1C
:
65186518 x : int
65196519 with self .assertRaises (TypeError ):
6520- class X (NamedTuple , NamedTuple ):
6520+ class Z (NamedTuple , NamedTuple ):
65216521 x : int
6522- class A (NamedTuple ):
6522+ class B (NamedTuple ):
65236523 x : int
65246524 with self .assertRaises (TypeError ):
6525- class X (NamedTuple , A ):
6525+ class C (NamedTuple , B ):
65266526 y : str
65276527
65286528 def test_generic (self ):
@@ -7108,13 +7108,13 @@ def test_cannot_subclass(self):
71087108 class C (type (Required )):
71097109 pass
71107110 with self .assertRaises (TypeError ):
7111- class C (type (Required [int ])):
7111+ class D (type (Required [int ])):
71127112 pass
71137113 with self .assertRaises (TypeError ):
7114- class C (Required ):
7114+ class E (Required ):
71157115 pass
71167116 with self .assertRaises (TypeError ):
7117- class C (Required [int ]):
7117+ class F (Required [int ]):
71187118 pass
71197119
71207120 def test_cannot_init (self ):
@@ -7154,13 +7154,13 @@ def test_cannot_subclass(self):
71547154 class C (type (NotRequired )):
71557155 pass
71567156 with self .assertRaises (TypeError ):
7157- class C (type (NotRequired [int ])):
7157+ class D (type (NotRequired [int ])):
71587158 pass
71597159 with self .assertRaises (TypeError ):
7160- class C (NotRequired ):
7160+ class E (NotRequired ):
71617161 pass
71627162 with self .assertRaises (TypeError ):
7163- class C (NotRequired [int ]):
7163+ class F (NotRequired [int ]):
71647164 pass
71657165
71667166 def test_cannot_init (self ):
@@ -7622,7 +7622,7 @@ class C(TypeAlias):
76227622 pass
76237623
76247624 with self .assertRaises (TypeError ):
7625- class C (type (TypeAlias )):
7625+ class D (type (TypeAlias )):
76267626 pass
76277627
76287628 def test_repr (self ):
@@ -8078,7 +8078,7 @@ def test_cannot_subclass(self):
80788078 class C (type (TypeGuard )):
80798079 pass
80808080 with self .assertRaises (TypeError ):
8081- class C (type (TypeGuard [int ])):
8081+ class D (type (TypeGuard [int ])):
80828082 pass
80838083
80848084 def test_cannot_init (self ):
0 commit comments