Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions pandas/tests/computation/test_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pytest

from pandas.compat import PY312
from pandas.compat._optional import import_optional_dependency
from pandas.errors import (
NumExprClobberingError,
PerformanceWarning,
Expand Down Expand Up @@ -53,6 +54,9 @@
_unary_math_ops,
)
from pandas.core.computation.scope import DEFAULT_GLOBALS
from pandas.util.version import Version

numexpr = import_optional_dependency("numexpr", errors="ignore")


@pytest.fixture(
Expand Down Expand Up @@ -320,7 +324,9 @@ def test_modulus(self, lhs, rhs, engine, parser):
def test_floor_division(self, lhs, rhs, engine, parser):
ex = "lhs // rhs"

if engine == "python":
if engine == "python" or (
engine == "numexpr" and Version(numexpr.__version__) >= Version("2.13.0")
):
res = pd.eval(ex, engine=engine, parser=parser)
expected = lhs // rhs
tm.assert_equal(res, expected)
Expand Down Expand Up @@ -391,7 +397,7 @@ def test_frame_invert(self, engine, parser):

# int raises on numexpr
lhs = DataFrame(np.random.default_rng(2).integers(5, size=(5, 2)))
if engine == "numexpr":
if engine == "numexpr" and Version(numexpr.__version__) < Version("2.13.0"):
msg = "couldn't find matching opcode for 'invert"
with pytest.raises(NotImplementedError, match=msg):
pd.eval(expr, engine=engine, parser=parser)
Expand Down Expand Up @@ -436,7 +442,7 @@ def test_series_invert(self, engine, parser):

# int raises on numexpr
lhs = Series(np.random.default_rng(2).integers(5, size=5))
if engine == "numexpr":
if engine == "numexpr" and Version(numexpr.__version__) < Version("2.13.0"):
msg = "couldn't find matching opcode for 'invert"
with pytest.raises(NotImplementedError, match=msg):
pd.eval(expr, engine=engine, parser=parser)
Expand Down
Loading