Skip to content

Commit dee12b3

Browse files
committed
Fix the test by explicitly specifing engine.
Also move the test to more appropriate file.
1 parent 1642cdb commit dee12b3

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

pandas/tests/computation/test_eval.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -737,13 +737,6 @@ def test_and_logic_string_match(self):
737737
assert pd.eval(f"{event.str.match('hello').a}")
738738
assert pd.eval(f"{event.str.match('hello').a and event.str.match('hello').a}")
739739

740-
def test_using_numpy(self):
741-
# GH 58041
742-
df = Series([0.2, 1.5, 2.8], name="a").to_frame()
743-
res = df.eval("@np.floor(a)")
744-
expected = np.floor(df["a"])
745-
tm.assert_series_equal(expected, res, check_names=False)
746-
747740

748741
# -------------------------------------
749742
# gh-12388: Typecasting rules consistency with python

pandas/tests/frame/test_query_eval.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,16 @@ def test_eval_object_dtype_binop(self):
188188
expected = DataFrame({"a1": ["Y", "N"], "c": [True, False]})
189189
tm.assert_frame_equal(res, expected)
190190

191+
def test_using_numpy(self, engine, parser):
192+
# GH 58041
193+
skip_if_no_pandas_parser(parser)
194+
df = Series([0.2, 1.5, 2.8], name="a").to_frame()
195+
res = df.eval("@np.floor(a)", engine=engine, parser=parser)
196+
expected = np.floor(df["a"])
197+
if engine == "numexpr":
198+
expected.name = None # See GH 58069
199+
tm.assert_series_equal(expected, res)
200+
191201

192202
class TestDataFrameQueryWithMultiIndex:
193203
def test_query_with_named_multiindex(self, parser, engine):

0 commit comments

Comments
 (0)