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

Method test_combine_le

pandas/tests/extension/base/methods.py:392–418  ·  view source on GitHub ↗
(self, data_repeated)

Source from the content-addressed store, hash-verified

390 _combine_le_expected_dtype: Dtype = NumpyEADtype("bool")
391
392 def test_combine_le(self, data_repeated):
393 # GH 20825
394 # Test that combine works when doing a <= (le) comparison
395 orig_data1, orig_data2 = data_repeated(2)
396 s1 = pd.Series(orig_data1)
397 s2 = pd.Series(orig_data2)
398 result = s1.combine(s2, lambda x1, x2: x1 <= x2)
399 expected = pd.Series(
400 pd.array(
401 [
402 a <= b
403 for (a, b) in zip(list(orig_data1), list(orig_data2), strict=True)
404 ],
405 dtype=self._combine_le_expected_dtype,
406 )
407 )
408 tm.assert_series_equal(result, expected)
409
410 val = s1.iloc[0]
411 result = s1.combine(val, lambda x1, x2: x1 <= x2)
412 expected = pd.Series(
413 pd.array(
414 [a <= val for a in list(orig_data1)],
415 dtype=self._combine_le_expected_dtype,
416 )
417 )
418 tm.assert_series_equal(result, expected)
419
420 def _construct_for_combine_add(self, left, right):
421 if isinstance(right, type(left)):

Callers

nothing calls this directly

Calls 3

combineMethod · 0.95
data_repeatedFunction · 0.50
arrayMethod · 0.45

Tested by

no test coverage detected