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

Method test_binary_ops

pandas/tests/test_expressions.py:216–240  ·  view source on GitHub ↗
(self, request, opname, op_str, left_fix, right_fix)

Source from the content-addressed store, hash-verified

214 "left_fix,right_fix", [("_array", "_array2"), ("_array_mixed", "_array_mixed2")]
215 )
216 def test_binary_ops(self, request, opname, op_str, left_fix, right_fix):
217 left = request.getfixturevalue(left_fix)
218 right = request.getfixturevalue(right_fix)
219
220 def testit(left, right, opname, op_str):
221 if opname == "pow":
222 left = np.abs(left)
223
224 op = getattr(operator, opname)
225
226 # array has 0s
227 result = expr.evaluate(op, left, left, use_numexpr=True)
228 expected = expr.evaluate(op, left, left, use_numexpr=False)
229 tm.assert_numpy_array_equal(result, expected)
230
231 result = expr._can_use_numexpr(op, op_str, right, right, "evaluate")
232 assert not result
233
234 with option_context("compute.use_numexpr", False):
235 testit(left, right, opname, op_str)
236
237 expr.set_numexpr_threads(1)
238 testit(left, right, opname, op_str)
239 expr.set_numexpr_threads()
240 testit(left, right, opname, op_str)
241
242 @pytest.mark.parametrize(
243 "left_fix,right_fix", [("_array", "_array2"), ("_array_mixed", "_array_mixed2")]

Callers

nothing calls this directly

Calls 1

option_contextFunction · 0.90

Tested by

no test coverage detected