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

Function test_array_NA

pandas/tests/arrays/masked/test_arithmetic.py:73–98  ·  view source on GitHub ↗
(data, all_arithmetic_operators)

Source from the content-addressed store, hash-verified

71
72
73def test_array_NA(data, all_arithmetic_operators):
74 data, _ = data
75 op = tm.get_op_from_name(all_arithmetic_operators)
76 check_skip(data, all_arithmetic_operators)
77
78 scalar = pd.NA
79 scalar_array = pd.array([pd.NA] * len(data), dtype=data.dtype)
80
81 mask = data._mask.copy()
82
83 if is_bool_not_implemented(data, all_arithmetic_operators):
84 msg = "operator '.*' not implemented for bool dtypes"
85 with pytest.raises(NotImplementedError, match=msg):
86 op(data, scalar)
87 # GH#45421 check op doesn't alter data._mask inplace
88 tm.assert_numpy_array_equal(mask, data._mask)
89 return
90
91 result = op(data, scalar)
92 # GH#45421 check op doesn't alter data._mask inplace
93 tm.assert_numpy_array_equal(mask, data._mask)
94
95 expected = op(data, scalar_array)
96 tm.assert_numpy_array_equal(mask, data._mask)
97
98 tm.assert_extension_array_equal(result, expected)
99
100
101def test_numpy_array_equivalence(data, all_arithmetic_operators):

Callers

nothing calls this directly

Calls 7

check_skipFunction · 0.85
is_bool_not_implementedFunction · 0.85
opFunction · 0.85
get_op_from_nameMethod · 0.45
arrayMethod · 0.45
copyMethod · 0.45
raisesMethod · 0.45

Tested by

no test coverage detected