Skip to content

Commit

Permalink
Pick required fix from 2542674 pandas-dev#56709
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Aug 22, 2024
1 parent d2d589a commit fa42c64
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pandas/tests/computation/test_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,11 +606,10 @@ def test_unary_in_array(self):
)
tm.assert_numpy_array_equal(result, expected)

@pytest.mark.parametrize("dtype", [np.float32, np.float64])
@pytest.mark.parametrize("expr", ["x < -0.1", "-5 > x"])
def test_float_comparison_bin_op(self, dtype, expr):
def test_float_comparison_bin_op(self, float_numpy_dtype, expr):
# GH 16363
df = DataFrame({"x": np.array([0], dtype=dtype)})
df = DataFrame({"x": np.array([0], dtype=float_numpy_dtype)})
res = df.eval(expr)
assert res.values == np.array([False])

Expand Down Expand Up @@ -747,15 +746,16 @@ class TestTypeCasting:
@pytest.mark.parametrize("op", ["+", "-", "*", "**", "/"])
# maybe someday... numexpr has too many upcasting rules now
# chain(*(np.core.sctypes[x] for x in ['uint', 'int', 'float']))
@pytest.mark.parametrize("dt", [np.float32, np.float64])
@pytest.mark.parametrize("left_right", [("df", "3"), ("3", "df")])
def test_binop_typecasting(self, engine, parser, op, dt, left_right):
df = DataFrame(np.random.default_rng(2).standard_normal((5, 3)), dtype=dt)
def test_binop_typecasting(self, engine, parser, op, float_numpy_dtype, left_right):
df = DataFrame(
np.random.default_rng(2).standard_normal((5, 3)), dtype=float_numpy_dtype
)
left, right = left_right
s = f"{left} {op} {right}"
res = pd.eval(s, engine=engine, parser=parser)
assert df.values.dtype == dt
assert res.values.dtype == dt
assert df.values.dtype == float_numpy_dtype
assert res.values.dtype == float_numpy_dtype
tm.assert_frame_equal(res, eval(s))


Expand Down

0 comments on commit fa42c64

Please sign in to comment.