MCPcopy
hub / github.com/pandas-dev/pandas / test_run_binary

Method test_run_binary

pandas/tests/test_expressions.py:167–190  ·  view source on GitHub ↗

tests solely that the result is the same whether or not numexpr is enabled. Need to test whether the function does the correct thing elsewhere.

(self, request, fixture, flex, comparison_op, monkeypatch)

Source from the content-addressed store, hash-verified

165 )
166 @pytest.mark.parametrize("flex", [True, False])
167 def test_run_binary(self, request, fixture, flex, comparison_op, monkeypatch):
168 """
169 tests solely that the result is the same whether or not numexpr is
170 enabled. Need to test whether the function does the correct thing
171 elsewhere.
172 """
173 df = request.getfixturevalue(fixture)
174 arith = comparison_op.__name__
175 with option_context("compute.use_numexpr", False):
176 other = df + 1
177
178 with monkeypatch.context() as m:
179 m.setattr(expr, "_MIN_ELEMENTS", 0)
180 expr.set_test_mode(True)
181
182 result, expected = self.call_op(df, other, flex, arith)
183
184 used_numexpr = expr.get_test_result()
185 assert used_numexpr, "Did not use numexpr as expected."
186 tm.assert_equal(expected, result)
187
188 for i in range(len(df.columns)):
189 binary_comp = other.iloc[:, i] + 1
190 self.call_op(df.iloc[:, i], binary_comp, flex, "add")
191
192 def test_invalid(self):
193 array = np.random.default_rng(2).standard_normal(1_000_001)

Callers

nothing calls this directly

Calls 2

call_opMethod · 0.95
option_contextFunction · 0.90

Tested by

no test coverage detected