@@ -575,6 +575,10 @@ def f(*args, **kwargs):
575
575
self .assertEqual (f (spam = 'fried' , ** {'eggs' :'scrambled' }),
576
576
((), {'eggs' :'scrambled' , 'spam' :'fried' }))
577
577
578
+ # Check ast errors in *args and *kwargs
579
+ check_syntax_error (self , "f(*g(1=2))" )
580
+ check_syntax_error (self , "f(**g(1=2))" )
581
+
578
582
# argument annotation tests
579
583
def f (x ) -> list : pass
580
584
self .assertEqual (f .__annotations__ , {'return' : list })
@@ -616,10 +620,6 @@ def f(x=1): return closure
616
620
def f (* , k = 1 ): return closure
617
621
def f () -> int : return closure
618
622
619
- # Check ast errors in *args and *kwargs
620
- check_syntax_error (self , "f(*g(1=2))" )
621
- check_syntax_error (self , "f(**g(1=2))" )
622
-
623
623
# Check trailing commas are permitted in funcdef argument list
624
624
def f (a ,): pass
625
625
def f (* args ,): pass
@@ -1091,7 +1091,6 @@ def test_try(self):
1091
1091
try : 1 / 0
1092
1092
except EOFError : pass
1093
1093
except TypeError as msg : pass
1094
- except RuntimeError as msg : pass
1095
1094
except : pass
1096
1095
else : pass
1097
1096
try : 1 / 0
@@ -1200,7 +1199,7 @@ def test_selectors(self):
1200
1199
d [1 ,2 ] = 3
1201
1200
d [1 ,2 ,3 ] = 4
1202
1201
L = list (d )
1203
- L .sort (key = lambda x : x if isinstance ( x , tuple ) else ( ))
1202
+ L .sort (key = lambda x : ( type ( x ). __name__ , x ))
1204
1203
self .assertEqual (str (L ), '[1, (1,), (1, 2), (1, 2, 3)]' )
1205
1204
1206
1205
def test_atoms (self ):
0 commit comments