@@ -473,7 +473,6 @@ def test_var_substitution(self):
473
473
474
474
def test_bad_var_substitution (self ):
475
475
T = TypeVar ('T' )
476
- P = ParamSpec ("P" )
477
476
bad_args = (
478
477
(), (int , str ), Union ,
479
478
Generic , Generic [T ], Protocol , Protocol [T ],
@@ -1037,8 +1036,6 @@ class G2(Generic[Unpack[Ts]]): pass
1037
1036
1038
1037
def test_repr_is_correct (self ):
1039
1038
Ts = TypeVarTuple ('Ts' )
1040
- T = TypeVar ('T' )
1041
- T2 = TypeVar ('T2' )
1042
1039
1043
1040
class G1 (Generic [* Ts ]): pass
1044
1041
class G2 (Generic [Unpack [Ts ]]): pass
@@ -1307,7 +1304,7 @@ def test_callable_args_are_correct(self):
1307
1304
i = Callable [[None ], * Ts ]
1308
1305
j = Callable [[None ], Unpack [Ts ]]
1309
1306
self .assertEqual (i .__args__ , (type (None ), * Ts ))
1310
- self .assertEqual (i .__args__ , (type (None ), Unpack [Ts ]))
1307
+ self .assertEqual (j .__args__ , (type (None ), Unpack [Ts ]))
1311
1308
1312
1309
k = Callable [[None ], tuple [int , * Ts ]]
1313
1310
l = Callable [[None ], Tuple [int , Unpack [Ts ]]]
@@ -1435,8 +1432,6 @@ def g(*args: *Ts): pass
1435
1432
self .assertEqual (g .__annotations__ , {'args' : (* Ts ,)[0 ]})
1436
1433
1437
1434
def test_variadic_args_with_ellipsis_annotations_are_correct (self ):
1438
- Ts = TypeVarTuple ('Ts' )
1439
-
1440
1435
def a (* args : * tuple [int , ...]): pass
1441
1436
self .assertEqual (a .__annotations__ ,
1442
1437
{'args' : (* tuple [int , ...],)[0 ]})
@@ -4918,7 +4913,6 @@ def test_overload_registry_repeated(self):
4918
4913
# Definitions needed for features introduced in Python 3.6
4919
4914
4920
4915
from test import ann_module , ann_module2 , ann_module3 , ann_module5 , ann_module6
4921
- import asyncio
4922
4916
4923
4917
T_a = TypeVar ('T_a' )
4924
4918
@@ -7077,16 +7071,6 @@ class C:
7077
7071
self .assertEqual (get_type_hints (C , globals ())['classvar' ], ClassVar [int ])
7078
7072
self .assertEqual (get_type_hints (C , globals ())['const' ], Final [int ])
7079
7073
7080
- def test_hash_eq (self ):
7081
- self .assertEqual (len ({Annotated [int , 4 , 5 ], Annotated [int , 4 , 5 ]}), 1 )
7082
- self .assertNotEqual (Annotated [int , 4 , 5 ], Annotated [int , 5 , 4 ])
7083
- self .assertNotEqual (Annotated [int , 4 , 5 ], Annotated [str , 4 , 5 ])
7084
- self .assertNotEqual (Annotated [int , 4 ], Annotated [int , 4 , 4 ])
7085
- self .assertEqual (
7086
- {Annotated [int , 4 , 5 ], Annotated [int , 4 , 5 ], Annotated [T , 4 , 5 ]},
7087
- {Annotated [int , 4 , 5 ], Annotated [T , 4 , 5 ]}
7088
- )
7089
-
7090
7074
def test_cannot_subclass (self ):
7091
7075
with self .assertRaisesRegex (TypeError , "Cannot subclass .*Annotated" ):
7092
7076
class C (Annotated ):
@@ -7515,7 +7499,6 @@ class Y(Generic[P, T]):
7515
7499
self .assertEqual (B .__args__ , ((int , str ,), Tuple [bytes , float ]))
7516
7500
7517
7501
def test_var_substitution (self ):
7518
- T = TypeVar ("T" )
7519
7502
P = ParamSpec ("P" )
7520
7503
subst = P .__typing_subst__
7521
7504
self .assertEqual (subst ((int , str )), (int , str ))
@@ -7835,7 +7818,7 @@ def test_special_attrs2(self):
7835
7818
self .assertEqual (fr .__module__ , 'typing' )
7836
7819
# Forward refs are currently unpicklable.
7837
7820
for proto in range (pickle .HIGHEST_PROTOCOL + 1 ):
7838
- with self .assertRaises (TypeError ) as exc :
7821
+ with self .assertRaises (TypeError ):
7839
7822
pickle .dumps (fr , proto )
7840
7823
7841
7824
self .assertEqual (SpecialAttrsTests .TypeName .__name__ , 'TypeName' )
0 commit comments