Skip to content

Resolve failures in tests while running with numpy 2.0 #2328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dpnp/tests/test_manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ def test_ndarray(self):
result = ia.reshape((2, 5))
assert_array_equal(result, expected)

@testing.with_requires("numpy>=2.0")
@testing.with_requires("numpy>=2.1")
def test_copy(self):
a = numpy.arange(10).reshape(2, 5)
ia = dpnp.array(a)
Expand Down
4 changes: 2 additions & 2 deletions dpnp/tests/test_mathematical.py
Original file line number Diff line number Diff line change
Expand Up @@ -2445,10 +2445,10 @@ def test_out(self, func_params, dtype):

assert result is dp_out
# numpy.ceil, numpy.floor, numpy.trunc always return float dtype for
# NumPy < 2.0.0 while output has the dtype of input for NumPy >= 2.0.0
# NumPy < 2.1.0 while output has the dtype of input for NumPy >= 2.1.0
# (dpnp follows the latter behavior except for boolean dtype where it
# returns int8)
if numpy_version() < "2.0.0" or dtype == numpy.bool:
if numpy_version() < "2.1.0" or dtype == numpy.bool:
check_type = False
else:
check_type = True
Expand Down
7 changes: 4 additions & 3 deletions dpnp/tests/test_strides.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ def test_1arg(func, dtype, stride):
result = getattr(dpnp, func)(ia)
expected = getattr(numpy, func)(a)

# numpy.ceil, numpy.floor, numpy.trunc always return float dtype for NumPy < 2.0.0
# while for NumPy >= 2.0.0, output has the dtype of input (dpnp follows this behavior)
if numpy.lib.NumpyVersion(numpy.__version__) < "2.0.0":
# numpy.ceil, numpy.floor, numpy.trunc always return float dtype for
# NumPy < 2.1.0 while for NumPy >= 2.1.0, output has the dtype of input
# (dpnp follows this behavior)
if numpy_version() < "2.1.0":
check_type = False
else:
check_type = True
Expand Down
Loading