@@ -469,7 +469,6 @@ def test_var_substitution(self):
469
469
470
470
def test_bad_var_substitution (self ):
471
471
T = TypeVar ('T' )
472
- P = ParamSpec ("P" )
473
472
bad_args = (
474
473
(), (int , str ), Union ,
475
474
Generic , Generic [T ], Protocol , Protocol [T ],
@@ -1033,8 +1032,6 @@ class G2(Generic[Unpack[Ts]]): pass
1033
1032
1034
1033
def test_repr_is_correct (self ):
1035
1034
Ts = TypeVarTuple ('Ts' )
1036
- T = TypeVar ('T' )
1037
- T2 = TypeVar ('T2' )
1038
1035
1039
1036
class G1 (Generic [* Ts ]): pass
1040
1037
class G2 (Generic [Unpack [Ts ]]): pass
@@ -1304,7 +1301,7 @@ def test_callable_args_are_correct(self):
1304
1301
i = Callable [[None ], * Ts ]
1305
1302
j = Callable [[None ], Unpack [Ts ]]
1306
1303
self .assertEqual (i .__args__ , (type (None ), * Ts ))
1307
- self .assertEqual (i .__args__ , (type (None ), Unpack [Ts ]))
1304
+ self .assertEqual (j .__args__ , (type (None ), Unpack [Ts ]))
1308
1305
1309
1306
k = Callable [[None ], tuple [int , * Ts ]]
1310
1307
l = Callable [[None ], Tuple [int , Unpack [Ts ]]]
@@ -1432,8 +1429,6 @@ def g(*args: *Ts): pass
1432
1429
self .assertEqual (g .__annotations__ , {'args' : (* Ts ,)[0 ]})
1433
1430
1434
1431
def test_variadic_args_with_ellipsis_annotations_are_correct (self ):
1435
- Ts = TypeVarTuple ('Ts' )
1436
-
1437
1432
def a (* args : * tuple [int , ...]): pass
1438
1433
self .assertEqual (a .__annotations__ ,
1439
1434
{'args' : (* tuple [int , ...],)[0 ]})
@@ -4769,7 +4764,6 @@ def test_overload_registry_repeated(self):
4769
4764
# Definitions needed for features introduced in Python 3.6
4770
4765
4771
4766
from test import ann_module , ann_module2 , ann_module3 , ann_module5 , ann_module6
4772
- import asyncio
4773
4767
4774
4768
T_a = TypeVar ('T_a' )
4775
4769
@@ -6898,16 +6892,6 @@ class C:
6898
6892
self .assertEqual (get_type_hints (C , globals ())['classvar' ], ClassVar [int ])
6899
6893
self .assertEqual (get_type_hints (C , globals ())['const' ], Final [int ])
6900
6894
6901
- def test_hash_eq (self ):
6902
- self .assertEqual (len ({Annotated [int , 4 , 5 ], Annotated [int , 4 , 5 ]}), 1 )
6903
- self .assertNotEqual (Annotated [int , 4 , 5 ], Annotated [int , 5 , 4 ])
6904
- self .assertNotEqual (Annotated [int , 4 , 5 ], Annotated [str , 4 , 5 ])
6905
- self .assertNotEqual (Annotated [int , 4 ], Annotated [int , 4 , 4 ])
6906
- self .assertEqual (
6907
- {Annotated [int , 4 , 5 ], Annotated [int , 4 , 5 ], Annotated [T , 4 , 5 ]},
6908
- {Annotated [int , 4 , 5 ], Annotated [T , 4 , 5 ]}
6909
- )
6910
-
6911
6895
def test_cannot_subclass (self ):
6912
6896
with self .assertRaisesRegex (TypeError , "Cannot subclass .*Annotated" ):
6913
6897
class C (Annotated ):
@@ -7335,7 +7319,6 @@ class Y(Generic[P, T]):
7335
7319
self .assertEqual (B .__args__ , ((int , str ,), Tuple [bytes , float ]))
7336
7320
7337
7321
def test_var_substitution (self ):
7338
- T = TypeVar ("T" )
7339
7322
P = ParamSpec ("P" )
7340
7323
subst = P .__typing_subst__
7341
7324
self .assertEqual (subst ((int , str )), (int , str ))
@@ -7628,7 +7611,7 @@ def test_special_attrs2(self):
7628
7611
self .assertEqual (fr .__module__ , 'typing' )
7629
7612
# Forward refs are currently unpicklable.
7630
7613
for proto in range (pickle .HIGHEST_PROTOCOL + 1 ):
7631
- with self .assertRaises (TypeError ) as exc :
7614
+ with self .assertRaises (TypeError ):
7632
7615
pickle .dumps (fr , proto )
7633
7616
7634
7617
self .assertEqual (SpecialAttrsTests .TypeName .__name__ , 'TypeName' )
0 commit comments