@@ -185,7 +185,7 @@ def test_cannot_subclass(self):
185
185
class A (self .bottom_type ):
186
186
pass
187
187
with self .assertRaisesRegex (TypeError , CANNOT_SUBCLASS_TYPE ):
188
- class A (type (self .bottom_type )):
188
+ class B (type (self .bottom_type )):
189
189
pass
190
190
191
191
def test_cannot_instantiate (self ):
@@ -282,7 +282,7 @@ class C(type(Self)):
282
282
pass
283
283
with self .assertRaisesRegex (TypeError ,
284
284
r'Cannot subclass typing\.Self' ):
285
- class C (Self ):
285
+ class D (Self ):
286
286
pass
287
287
288
288
def test_cannot_init (self ):
@@ -339,7 +339,7 @@ class C(type(LiteralString)):
339
339
pass
340
340
with self .assertRaisesRegex (TypeError ,
341
341
r'Cannot subclass typing\.LiteralString' ):
342
- class C (LiteralString ):
342
+ class D (LiteralString ):
343
343
pass
344
344
345
345
def test_cannot_init (self ):
@@ -483,7 +483,7 @@ class V(TypeVar): pass
483
483
T = TypeVar ("T" )
484
484
with self .assertRaisesRegex (TypeError ,
485
485
CANNOT_SUBCLASS_INSTANCE % 'TypeVar' ):
486
- class V (T ): pass
486
+ class W (T ): pass
487
487
488
488
def test_cannot_instantiate_vars (self ):
489
489
with self .assertRaises (TypeError ):
@@ -1244,20 +1244,20 @@ class C(TypeVarTuple): pass
1244
1244
Ts = TypeVarTuple ('Ts' )
1245
1245
with self .assertRaisesRegex (TypeError ,
1246
1246
CANNOT_SUBCLASS_INSTANCE % 'TypeVarTuple' ):
1247
- class C (Ts ): pass
1247
+ class D (Ts ): pass
1248
1248
with self .assertRaisesRegex (TypeError , CANNOT_SUBCLASS_TYPE ):
1249
- class C (type (Unpack )): pass
1249
+ class E (type (Unpack )): pass
1250
1250
with self .assertRaisesRegex (TypeError , CANNOT_SUBCLASS_TYPE ):
1251
- class C (type (* Ts )): pass
1251
+ class F (type (* Ts )): pass
1252
1252
with self .assertRaisesRegex (TypeError , CANNOT_SUBCLASS_TYPE ):
1253
- class C (type (Unpack [Ts ])): pass
1253
+ class G (type (Unpack [Ts ])): pass
1254
1254
with self .assertRaisesRegex (TypeError ,
1255
1255
r'Cannot subclass typing\.Unpack' ):
1256
- class C (Unpack ): pass
1256
+ class H (Unpack ): pass
1257
1257
with self .assertRaisesRegex (TypeError , r'Cannot subclass typing.Unpack\[Ts\]' ):
1258
- class C (* Ts ): pass
1258
+ class I (* Ts ): pass
1259
1259
with self .assertRaisesRegex (TypeError , r'Cannot subclass typing.Unpack\[Ts\]' ):
1260
- class C (Unpack [Ts ]): pass
1260
+ class J (Unpack [Ts ]): pass
1261
1261
1262
1262
def test_variadic_class_args_are_correct (self ):
1263
1263
T = TypeVar ('T' )
@@ -1431,12 +1431,12 @@ def test_variadic_class_with_duplicate_typevartuples_fails(self):
1431
1431
with self .assertRaises (TypeError ):
1432
1432
class C (Generic [* Ts1 , * Ts1 ]): pass
1433
1433
with self .assertRaises (TypeError ):
1434
- class C (Generic [Unpack [Ts1 ], Unpack [Ts1 ]]): pass
1434
+ class D (Generic [Unpack [Ts1 ], Unpack [Ts1 ]]): pass
1435
1435
1436
1436
with self .assertRaises (TypeError ):
1437
- class C (Generic [* Ts1 , * Ts2 , * Ts1 ]): pass
1437
+ class E (Generic [* Ts1 , * Ts2 , * Ts1 ]): pass
1438
1438
with self .assertRaises (TypeError ):
1439
- class C (Generic [Unpack [Ts1 ], Unpack [Ts2 ], Unpack [Ts1 ]]): pass
1439
+ class F (Generic [Unpack [Ts1 ], Unpack [Ts2 ], Unpack [Ts1 ]]): pass
1440
1440
1441
1441
def test_type_concatenation_in_variadic_class_argument_list_succeeds (self ):
1442
1442
Ts = TypeVarTuple ('Ts' )
@@ -1804,11 +1804,11 @@ def test_cannot_subclass(self):
1804
1804
class C (Union ):
1805
1805
pass
1806
1806
with self .assertRaisesRegex (TypeError , CANNOT_SUBCLASS_TYPE ):
1807
- class C (type (Union )):
1807
+ class D (type (Union )):
1808
1808
pass
1809
1809
with self .assertRaisesRegex (TypeError ,
1810
1810
r'Cannot subclass typing\.Union\[int, str\]' ):
1811
- class C (Union [int , str ]):
1811
+ class E (Union [int , str ]):
1812
1812
pass
1813
1813
1814
1814
def test_cannot_instantiate (self ):
@@ -2557,10 +2557,10 @@ class BP(Protocol): pass
2557
2557
class P (C , Protocol ):
2558
2558
pass
2559
2559
with self .assertRaises (TypeError ):
2560
- class P (Protocol , C ):
2560
+ class Q (Protocol , C ):
2561
2561
pass
2562
2562
with self .assertRaises (TypeError ):
2563
- class P (BP , C , Protocol ):
2563
+ class R (BP , C , Protocol ):
2564
2564
pass
2565
2565
2566
2566
class D (BP , C ): pass
@@ -2836,7 +2836,7 @@ class NotAProtocolButAnImplicitSubclass3:
2836
2836
meth : Callable [[], None ]
2837
2837
meth2 : Callable [[int , str ], bool ]
2838
2838
def meth (self ): pass
2839
- def meth (self , x , y ): return True
2839
+ def meth2 (self , x , y ): return True
2840
2840
2841
2841
self .assertNotIsSubclass (AnnotatedButNotAProtocol , CallableMembersProto )
2842
2842
self .assertIsSubclass (NotAProtocolButAnImplicitSubclass , CallableMembersProto )
@@ -3646,11 +3646,11 @@ def test_protocols_bad_subscripts(self):
3646
3646
with self .assertRaises (TypeError ):
3647
3647
class P (Protocol [T , T ]): pass
3648
3648
with self .assertRaises (TypeError ):
3649
- class P (Protocol [int ]): pass
3649
+ class Q (Protocol [int ]): pass
3650
3650
with self .assertRaises (TypeError ):
3651
- class P (Protocol [T ], Protocol [S ]): pass
3651
+ class R (Protocol [T ], Protocol [S ]): pass
3652
3652
with self .assertRaises (TypeError ):
3653
- class P (typing .Mapping [T , S ], Protocol [T ]): pass
3653
+ class S (typing .Mapping [T , S ], Protocol [T ]): pass
3654
3654
3655
3655
def test_generic_protocols_repr (self ):
3656
3656
T = TypeVar ('T' )
@@ -4029,12 +4029,12 @@ class NewGeneric(Generic): ...
4029
4029
with self .assertRaises (TypeError ):
4030
4030
class MyGeneric (Generic [T ], Generic [S ]): ...
4031
4031
with self .assertRaises (TypeError ):
4032
- class MyGeneric (List [T ], Generic [S ]): ...
4032
+ class MyGeneric2 (List [T ], Generic [S ]): ...
4033
4033
with self .assertRaises (TypeError ):
4034
4034
Generic [()]
4035
- class C (Generic [T ]): pass
4035
+ class D (Generic [T ]): pass
4036
4036
with self .assertRaises (TypeError ):
4037
- C [()]
4037
+ D [()]
4038
4038
4039
4039
def test_init (self ):
4040
4040
T = TypeVar ('T' )
@@ -4755,7 +4755,7 @@ class Test(Generic[T], Final):
4755
4755
class Subclass (Test ):
4756
4756
pass
4757
4757
with self .assertRaises (FinalException ):
4758
- class Subclass (Test [int ]):
4758
+ class Subclass2 (Test [int ]):
4759
4759
pass
4760
4760
4761
4761
def test_nested (self ):
@@ -4993,15 +4993,15 @@ def test_cannot_subclass(self):
4993
4993
class C (type (ClassVar )):
4994
4994
pass
4995
4995
with self .assertRaisesRegex (TypeError , CANNOT_SUBCLASS_TYPE ):
4996
- class C (type (ClassVar [int ])):
4996
+ class D (type (ClassVar [int ])):
4997
4997
pass
4998
4998
with self .assertRaisesRegex (TypeError ,
4999
4999
r'Cannot subclass typing\.ClassVar' ):
5000
- class C (ClassVar ):
5000
+ class E (ClassVar ):
5001
5001
pass
5002
5002
with self .assertRaisesRegex (TypeError ,
5003
5003
r'Cannot subclass typing\.ClassVar\[int\]' ):
5004
- class C (ClassVar [int ]):
5004
+ class F (ClassVar [int ]):
5005
5005
pass
5006
5006
5007
5007
def test_cannot_init (self ):
@@ -5043,15 +5043,15 @@ def test_cannot_subclass(self):
5043
5043
class C (type (Final )):
5044
5044
pass
5045
5045
with self .assertRaisesRegex (TypeError , CANNOT_SUBCLASS_TYPE ):
5046
- class C (type (Final [int ])):
5046
+ class D (type (Final [int ])):
5047
5047
pass
5048
5048
with self .assertRaisesRegex (TypeError ,
5049
5049
r'Cannot subclass typing\.Final' ):
5050
- class C (Final ):
5050
+ class E (Final ):
5051
5051
pass
5052
5052
with self .assertRaisesRegex (TypeError ,
5053
5053
r'Cannot subclass typing\.Final\[int\]' ):
5054
- class C (Final [int ]):
5054
+ class F (Final [int ]):
5055
5055
pass
5056
5056
5057
5057
def test_cannot_init (self ):
@@ -7180,15 +7180,15 @@ class A:
7180
7180
class X (NamedTuple , A ):
7181
7181
x : int
7182
7182
with self .assertRaises (TypeError ):
7183
- class X (NamedTuple , tuple ):
7183
+ class Y (NamedTuple , tuple ):
7184
7184
x : int
7185
7185
with self .assertRaises (TypeError ):
7186
- class X (NamedTuple , NamedTuple ):
7186
+ class Z (NamedTuple , NamedTuple ):
7187
7187
x : int
7188
- class A (NamedTuple ):
7188
+ class B (NamedTuple ):
7189
7189
x : int
7190
7190
with self .assertRaises (TypeError ):
7191
- class X (NamedTuple , A ):
7191
+ class C (NamedTuple , B ):
7192
7192
y : str
7193
7193
7194
7194
def test_generic (self ):
@@ -7869,15 +7869,15 @@ def test_cannot_subclass(self):
7869
7869
class C (type (Required )):
7870
7870
pass
7871
7871
with self .assertRaisesRegex (TypeError , CANNOT_SUBCLASS_TYPE ):
7872
- class C (type (Required [int ])):
7872
+ class D (type (Required [int ])):
7873
7873
pass
7874
7874
with self .assertRaisesRegex (TypeError ,
7875
7875
r'Cannot subclass typing\.Required' ):
7876
- class C (Required ):
7876
+ class E (Required ):
7877
7877
pass
7878
7878
with self .assertRaisesRegex (TypeError ,
7879
7879
r'Cannot subclass typing\.Required\[int\]' ):
7880
- class C (Required [int ]):
7880
+ class F (Required [int ]):
7881
7881
pass
7882
7882
7883
7883
def test_cannot_init (self ):
@@ -7917,15 +7917,15 @@ def test_cannot_subclass(self):
7917
7917
class C (type (NotRequired )):
7918
7918
pass
7919
7919
with self .assertRaisesRegex (TypeError , CANNOT_SUBCLASS_TYPE ):
7920
- class C (type (NotRequired [int ])):
7920
+ class D (type (NotRequired [int ])):
7921
7921
pass
7922
7922
with self .assertRaisesRegex (TypeError ,
7923
7923
r'Cannot subclass typing\.NotRequired' ):
7924
- class C (NotRequired ):
7924
+ class E (NotRequired ):
7925
7925
pass
7926
7926
with self .assertRaisesRegex (TypeError ,
7927
7927
r'Cannot subclass typing\.NotRequired\[int\]' ):
7928
- class C (NotRequired [int ]):
7928
+ class F (NotRequired [int ]):
7929
7929
pass
7930
7930
7931
7931
def test_cannot_init (self ):
@@ -8045,7 +8045,7 @@ class A(typing.Match):
8045
8045
TypeError ,
8046
8046
r"type 're\.Pattern' is not an acceptable base type" ,
8047
8047
):
8048
- class A (typing .Pattern ):
8048
+ class B (typing .Pattern ):
8049
8049
pass
8050
8050
8051
8051
@@ -8393,7 +8393,7 @@ class C(TypeAlias):
8393
8393
pass
8394
8394
8395
8395
with self .assertRaises (TypeError ):
8396
- class C (type (TypeAlias )):
8396
+ class D (type (TypeAlias )):
8397
8397
pass
8398
8398
8399
8399
def test_repr (self ):
@@ -8783,19 +8783,19 @@ def test_cannot_subclass(self):
8783
8783
with self .assertRaisesRegex (TypeError , NOT_A_BASE_TYPE % 'ParamSpec' ):
8784
8784
class C (ParamSpec ): pass
8785
8785
with self .assertRaisesRegex (TypeError , NOT_A_BASE_TYPE % 'ParamSpecArgs' ):
8786
- class C (ParamSpecArgs ): pass
8786
+ class D (ParamSpecArgs ): pass
8787
8787
with self .assertRaisesRegex (TypeError , NOT_A_BASE_TYPE % 'ParamSpecKwargs' ):
8788
- class C (ParamSpecKwargs ): pass
8788
+ class E (ParamSpecKwargs ): pass
8789
8789
P = ParamSpec ('P' )
8790
8790
with self .assertRaisesRegex (TypeError ,
8791
8791
CANNOT_SUBCLASS_INSTANCE % 'ParamSpec' ):
8792
- class C (P ): pass
8792
+ class F (P ): pass
8793
8793
with self .assertRaisesRegex (TypeError ,
8794
8794
CANNOT_SUBCLASS_INSTANCE % 'ParamSpecArgs' ):
8795
- class C (P .args ): pass
8795
+ class G (P .args ): pass
8796
8796
with self .assertRaisesRegex (TypeError ,
8797
8797
CANNOT_SUBCLASS_INSTANCE % 'ParamSpecKwargs' ):
8798
- class C (P .kwargs ): pass
8798
+ class H (P .kwargs ): pass
8799
8799
8800
8800
8801
8801
class ConcatenateTests (BaseTestCase ):
@@ -8876,15 +8876,15 @@ def test_cannot_subclass(self):
8876
8876
class C (type (TypeGuard )):
8877
8877
pass
8878
8878
with self .assertRaisesRegex (TypeError , CANNOT_SUBCLASS_TYPE ):
8879
- class C (type (TypeGuard [int ])):
8879
+ class D (type (TypeGuard [int ])):
8880
8880
pass
8881
8881
with self .assertRaisesRegex (TypeError ,
8882
8882
r'Cannot subclass typing\.TypeGuard' ):
8883
- class C (TypeGuard ):
8883
+ class E (TypeGuard ):
8884
8884
pass
8885
8885
with self .assertRaisesRegex (TypeError ,
8886
8886
r'Cannot subclass typing\.TypeGuard\[int\]' ):
8887
- class C (TypeGuard [int ]):
8887
+ class F (TypeGuard [int ]):
8888
8888
pass
8889
8889
8890
8890
def test_cannot_init (self ):
0 commit comments