@@ -473,7 +473,6 @@ def test_var_substitution(self):
473473
474474 def test_bad_var_substitution (self ):
475475 T = TypeVar ('T' )
476- P = ParamSpec ("P" )
477476 bad_args = (
478477 (), (int , str ), Union ,
479478 Generic , Generic [T ], Protocol , Protocol [T ],
@@ -1037,8 +1036,6 @@ class G2(Generic[Unpack[Ts]]): pass
10371036
10381037 def test_repr_is_correct (self ):
10391038 Ts = TypeVarTuple ('Ts' )
1040- T = TypeVar ('T' )
1041- T2 = TypeVar ('T2' )
10421039
10431040 class G1 (Generic [* Ts ]): pass
10441041 class G2 (Generic [Unpack [Ts ]]): pass
@@ -1307,7 +1304,7 @@ def test_callable_args_are_correct(self):
13071304 i = Callable [[None ], * Ts ]
13081305 j = Callable [[None ], Unpack [Ts ]]
13091306 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 ]))
13111308
13121309 k = Callable [[None ], tuple [int , * Ts ]]
13131310 l = Callable [[None ], Tuple [int , Unpack [Ts ]]]
@@ -1435,8 +1432,6 @@ def g(*args: *Ts): pass
14351432 self .assertEqual (g .__annotations__ , {'args' : (* Ts ,)[0 ]})
14361433
14371434 def test_variadic_args_with_ellipsis_annotations_are_correct (self ):
1438- Ts = TypeVarTuple ('Ts' )
1439-
14401435 def a (* args : * tuple [int , ...]): pass
14411436 self .assertEqual (a .__annotations__ ,
14421437 {'args' : (* tuple [int , ...],)[0 ]})
@@ -4918,7 +4913,6 @@ def test_overload_registry_repeated(self):
49184913# Definitions needed for features introduced in Python 3.6
49194914
49204915from test import ann_module , ann_module2 , ann_module3 , ann_module5 , ann_module6
4921- import asyncio
49224916
49234917T_a = TypeVar ('T_a' )
49244918
@@ -7077,16 +7071,6 @@ class C:
70777071 self .assertEqual (get_type_hints (C , globals ())['classvar' ], ClassVar [int ])
70787072 self .assertEqual (get_type_hints (C , globals ())['const' ], Final [int ])
70797073
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-
70907074 def test_cannot_subclass (self ):
70917075 with self .assertRaisesRegex (TypeError , "Cannot subclass .*Annotated" ):
70927076 class C (Annotated ):
@@ -7515,7 +7499,6 @@ class Y(Generic[P, T]):
75157499 self .assertEqual (B .__args__ , ((int , str ,), Tuple [bytes , float ]))
75167500
75177501 def test_var_substitution (self ):
7518- T = TypeVar ("T" )
75197502 P = ParamSpec ("P" )
75207503 subst = P .__typing_subst__
75217504 self .assertEqual (subst ((int , str )), (int , str ))
@@ -7835,7 +7818,7 @@ def test_special_attrs2(self):
78357818 self .assertEqual (fr .__module__ , 'typing' )
78367819 # Forward refs are currently unpicklable.
78377820 for proto in range (pickle .HIGHEST_PROTOCOL + 1 ):
7838- with self .assertRaises (TypeError ) as exc :
7821+ with self .assertRaises (TypeError ):
78397822 pickle .dumps (fr , proto )
78407823
78417824 self .assertEqual (SpecialAttrsTests .TypeName .__name__ , 'TypeName' )
0 commit comments