Skip to content

Commit c342e9f

Browse files
authored
Extend eval test of standard functions to cover python engine. (#58393)
Extend eval test of ops to cover pandas engine.
1 parent b6c15ea commit c342e9f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

pandas/tests/computation/test_eval.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -1609,22 +1609,20 @@ def eval(self, *args, **kwargs):
16091609
kwargs["level"] = kwargs.pop("level", 0) + 1
16101610
return pd.eval(*args, **kwargs)
16111611

1612-
@pytest.mark.skipif(
1613-
not NUMEXPR_INSTALLED, reason="Unary ops only implemented for numexpr"
1614-
)
1612+
@pytest.mark.filterwarnings("ignore::RuntimeWarning")
16151613
@pytest.mark.parametrize("fn", _unary_math_ops)
1616-
def test_unary_functions(self, fn):
1614+
def test_unary_functions(self, fn, engine, parser):
16171615
df = DataFrame({"a": np.random.default_rng(2).standard_normal(10)})
16181616
a = df.a
16191617

16201618
expr = f"{fn}(a)"
1621-
got = self.eval(expr)
1619+
got = self.eval(expr, engine=engine, parser=parser)
16221620
with np.errstate(all="ignore"):
16231621
expect = getattr(np, fn)(a)
16241622
tm.assert_series_equal(got, expect, check_names=False)
16251623

16261624
@pytest.mark.parametrize("fn", _binary_math_ops)
1627-
def test_binary_functions(self, fn):
1625+
def test_binary_functions(self, fn, engine, parser):
16281626
df = DataFrame(
16291627
{
16301628
"a": np.random.default_rng(2).standard_normal(10),
@@ -1635,7 +1633,7 @@ def test_binary_functions(self, fn):
16351633
b = df.b
16361634

16371635
expr = f"{fn}(a, b)"
1638-
got = self.eval(expr)
1636+
got = self.eval(expr, engine=engine, parser=parser)
16391637
with np.errstate(all="ignore"):
16401638
expect = getattr(np, fn)(a, b)
16411639
tm.assert_almost_equal(got, expect, check_names=False)

0 commit comments

Comments
 (0)