@@ -3239,46 +3239,6 @@ def test_folding_tuple(self):
32393239
32403240 self .assert_ast (code , non_optimized_target , optimized_target )
32413241
3242- def test_folding_comparator (self ):
3243- code = "1 %s %s1%s"
3244- operators = [("in" , ast .In ()), ("not in" , ast .NotIn ())]
3245- braces = [
3246- ("[" , "]" , ast .List , (1 ,)),
3247- ("{" , "}" , ast .Set , frozenset ({1 })),
3248- ]
3249- for left , right , non_optimized_comparator , optimized_comparator in braces :
3250- for op , node in operators :
3251- non_optimized_target = self .wrap_expr (ast .Compare (
3252- left = ast .Constant (1 ), ops = [node ],
3253- comparators = [non_optimized_comparator (elts = [ast .Constant (1 )])]
3254- ))
3255- optimized_target = self .wrap_expr (ast .Compare (
3256- left = ast .Constant (1 ), ops = [node ],
3257- comparators = [ast .Constant (value = optimized_comparator )]
3258- ))
3259- self .assert_ast (code % (op , left , right ), non_optimized_target , optimized_target )
3260-
3261- def test_folding_iter (self ):
3262- code = "for _ in %s1%s: pass"
3263- braces = [
3264- ("[" , "]" , ast .List , (1 ,)),
3265- ("{" , "}" , ast .Set , frozenset ({1 })),
3266- ]
3267-
3268- for left , right , ast_cls , optimized_iter in braces :
3269- non_optimized_target = self .wrap_statement (ast .For (
3270- target = ast .Name (id = "_" , ctx = ast .Store ()),
3271- iter = ast_cls (elts = [ast .Constant (1 )]),
3272- body = [ast .Pass ()]
3273- ))
3274- optimized_target = self .wrap_statement (ast .For (
3275- target = ast .Name (id = "_" , ctx = ast .Store ()),
3276- iter = ast .Constant (value = optimized_iter ),
3277- body = [ast .Pass ()]
3278- ))
3279-
3280- self .assert_ast (code % (left , right ), non_optimized_target , optimized_target )
3281-
32823242 def test_folding_type_param_in_function_def (self ):
32833243 code = "def foo[%s = 1 + 1](): pass"
32843244
0 commit comments