(data, all_arithmetic_operators)
| 71 | |
| 72 | |
| 73 | def 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 | |
| 101 | def test_numpy_array_equivalence(data, all_arithmetic_operators): |
nothing calls this directly
no test coverage detected