Skip to content

Commit 1dafb3b

Browse files
committed
update tests for numpy>=2
1 parent a660cb7 commit 1dafb3b

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

dpnp/tests/test_bitwise.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
import dpnp
66

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
89

910

1011
@pytest.mark.parametrize(
@@ -67,12 +68,14 @@ def test_bitwise_xor(self, lhs, rhs, dtype):
6768
assert_array_equal(ia ^ ib, a ^ b)
6869

6970
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)
7173
ia, ib, a, b = self._test_binary("left_shift", lhs, rhs, dtype)
7274
assert_array_equal(ia << ib, a << b)
7375

7476
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)
7679
ia, ib, a, b = self._test_binary("right_shift", lhs, rhs, dtype)
7780
assert_array_equal(ia >> ib, a >> b)
7881

@@ -216,11 +219,13 @@ def _test_unary(self, name, data, dtype):
216219

217220
return (ia, a)
218221

222+
@testing.with_requires("numpy>=2.0")
219223
def test_bitwise_count(self, val, dtype):
220224
_ = self._test_unary("bitwise_count", val, dtype)
221225

222226
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)
226231
assert_array_equal(~ia, ~a)

0 commit comments

Comments
 (0)