|
4 | 4 |
|
5 | 5 | import dpnp
|
6 | 6 |
|
7 |
| -from .helper import assert_dtype_allclose, get_integer_dtypes |
| 7 | +from .helper import assert_dtype_allclose, get_integer_dtypes, numpy_version |
| 8 | +from .third_party.cupy import testing |
8 | 9 |
|
9 | 10 |
|
10 | 11 | @pytest.mark.parametrize(
|
@@ -67,12 +68,14 @@ def test_bitwise_xor(self, lhs, rhs, dtype):
|
67 | 68 | assert_array_equal(ia ^ ib, a ^ b)
|
68 | 69 |
|
69 | 70 | def test_left_shift(self, lhs, rhs, dtype):
|
70 |
| - _ = self._test_binary("bitwise_left_shift", lhs, rhs, dtype) |
| 71 | + if numpy_version() >= "2.0.0": |
| 72 | + _ = self._test_binary("bitwise_left_shift", lhs, rhs, dtype) |
71 | 73 | ia, ib, a, b = self._test_binary("left_shift", lhs, rhs, dtype)
|
72 | 74 | assert_array_equal(ia << ib, a << b)
|
73 | 75 |
|
74 | 76 | def test_right_shift(self, lhs, rhs, dtype):
|
75 |
| - _ = self._test_binary("bitwise_right_shift", lhs, rhs, dtype) |
| 77 | + if numpy_version() >= "2.0.0": |
| 78 | + _ = self._test_binary("bitwise_right_shift", lhs, rhs, dtype) |
76 | 79 | ia, ib, a, b = self._test_binary("right_shift", lhs, rhs, dtype)
|
77 | 80 | assert_array_equal(ia >> ib, a >> b)
|
78 | 81 |
|
@@ -216,11 +219,13 @@ def _test_unary(self, name, data, dtype):
|
216 | 219 |
|
217 | 220 | return (ia, a)
|
218 | 221 |
|
| 222 | + @testing.with_requires("numpy>=2.0") |
219 | 223 | def test_bitwise_count(self, val, dtype):
|
220 | 224 | _ = self._test_unary("bitwise_count", val, dtype)
|
221 | 225 |
|
222 | 226 | def test_invert(self, val, dtype):
|
223 |
| - _ = self._test_unary("invert", val, dtype) |
224 |
| - _ = self._test_unary("bitwise_invert", val, dtype) |
225 |
| - ia, a = self._test_unary("bitwise_not", val, dtype) |
| 227 | + if numpy_version() >= "2.0.0": |
| 228 | + _ = self._test_unary("bitwise_not", val, dtype) |
| 229 | + _ = self._test_unary("bitwise_invert", val, dtype) |
| 230 | + ia, a = self._test_unary("invert", val, dtype) |
226 | 231 | assert_array_equal(~ia, ~a)
|
0 commit comments