Skip to content

Commit f85acd9

Browse files
authored
Create eval test (#47236)
1 parent 62b6d25 commit f85acd9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/computation/test_eval.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,18 @@ def test_disallow_python_keywords(self):
692692
with pytest.raises(SyntaxError, match=msg):
693693
df.query("lambda == 0")
694694

695+
def test_true_false_logic(self):
696+
# GH 25823
697+
assert pd.eval("not True") == -2
698+
assert pd.eval("not False") == -1
699+
assert pd.eval("True and not True") == 0
700+
701+
def test_and_logic_string_match(self):
702+
# GH 25823
703+
event = Series({"a": "hello"})
704+
assert pd.eval(f"{event.str.match('hello').a}")
705+
assert pd.eval(f"{event.str.match('hello').a and event.str.match('hello').a}")
706+
695707

696708
f = lambda *args, **kwargs: np.random.randn()
697709

0 commit comments

Comments
 (0)