@@ -168,7 +168,7 @@ def setup_ops(self):
168
168
def setup_method (self , method ):
169
169
self .setup_ops ()
170
170
self .setup_data ()
171
- self .current_engines = filter ( lambda x : x != self .engine , _engines )
171
+ self .current_engines = ( engine for engine in _engines if engine != self .engine )
172
172
173
173
def teardown_method (self , method ):
174
174
del self .lhses , self .rhses , self .scalar_rhses , self .scalar_lhses
@@ -774,11 +774,9 @@ def setup_class(cls):
774
774
cls .parser = "python"
775
775
776
776
def setup_ops (self ):
777
- self .cmp_ops = list (
778
- filter (lambda x : x not in ("in" , "not in" ), expr ._cmp_ops_syms )
779
- )
777
+ self .cmp_ops = [op for op in expr ._cmp_ops_syms if op not in ("in" , "not in" )]
780
778
self .cmp2_ops = self .cmp_ops [::- 1 ]
781
- self .bin_ops = [s for s in expr ._bool_ops_syms if s not in ("and" , "or" )]
779
+ self .bin_ops = [op for op in expr ._bool_ops_syms if op not in ("and" , "or" )]
782
780
self .special_case_ops = _special_case_arith_ops_syms
783
781
self .arith_ops = _good_arith_ops
784
782
self .unary_ops = "+" , "-" , "~"
@@ -1150,9 +1148,9 @@ def eval(self, *args, **kwargs):
1150
1148
return pd .eval (* args , ** kwargs )
1151
1149
1152
1150
def test_simple_arith_ops (self ):
1153
- ops = self .arith_ops
1151
+ ops = ( op for op in self .arith_ops if op != "//" )
1154
1152
1155
- for op in filter ( lambda x : x != "//" , ops ) :
1153
+ for op in ops :
1156
1154
ex = f"1 { op } 1"
1157
1155
ex2 = f"x { op } 1"
1158
1156
ex3 = f"1 { op } (x + 1)"
@@ -1637,8 +1635,11 @@ def setup_class(cls):
1637
1635
super ().setup_class ()
1638
1636
cls .engine = "numexpr"
1639
1637
cls .parser = "python"
1640
- cls .arith_ops = expr ._arith_ops_syms + expr ._cmp_ops_syms
1641
- cls .arith_ops = filter (lambda x : x not in ("in" , "not in" ), cls .arith_ops )
1638
+ cls .arith_ops = [
1639
+ op
1640
+ for op in expr ._arith_ops_syms + expr ._cmp_ops_syms
1641
+ if op not in ("in" , "not in" )
1642
+ ]
1642
1643
1643
1644
def test_check_many_exprs (self ):
1644
1645
a = 1 # noqa
@@ -1726,8 +1727,11 @@ class TestOperationsPythonPython(TestOperationsNumExprPython):
1726
1727
def setup_class (cls ):
1727
1728
super ().setup_class ()
1728
1729
cls .engine = cls .parser = "python"
1729
- cls .arith_ops = expr ._arith_ops_syms + expr ._cmp_ops_syms
1730
- cls .arith_ops = filter (lambda x : x not in ("in" , "not in" ), cls .arith_ops )
1730
+ cls .arith_ops = [
1731
+ op
1732
+ for op in expr ._arith_ops_syms + expr ._cmp_ops_syms
1733
+ if op not in ("in" , "not in" )
1734
+ ]
1731
1735
1732
1736
1733
1737
class TestOperationsPythonPandas (TestOperationsNumExprPandas ):
0 commit comments