Skip to content

Commit e4560bd

Browse files
Add test_asfarray_deprecated instead of test_asfarray_coverage
1 parent 2106519 commit e4560bd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

dpnp/tests/test_arraymanipulation.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import warnings
2+
13
import dpctl.tensor as dpt
24
import numpy
35
import pytest
@@ -31,15 +33,15 @@ def test_asfarray2(self, dtype, data, data_dtype):
3133
result = dpnp.asfarray(dpnp.array(data, dtype=data_dtype), dtype)
3234
assert_array_equal(result, expected)
3335

34-
# This is only for coverage with NumPy 2.0 and above
35-
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
36-
def test_asfarray_coverage(self):
36+
def test_asfarray_deprecated(self):
3737
expected = dpnp.array([1.0, 2.0, 3.0])
38-
result = dpnp.asfarray([1, 2, 3])
38+
with pytest.warns(DeprecationWarning, match="deprecated"):
39+
result = dpnp.asfarray([1, 2, 3])
3940
assert_array_equal(result, expected)
4041

4142
expected = dpnp.array([1.0, 2.0, 3.0], dtype=dpnp.float32)
42-
result = dpnp.asfarray([1, 2, 3], dtype=dpnp.float32)
43+
with pytest.warns(DeprecationWarning, match="deprecated"):
44+
result = dpnp.asfarray([1, 2, 3], dtype=dpnp.float32)
4345
assert_array_equal(result, expected)
4446

4547

0 commit comments

Comments
 (0)