|
| 1 | +import warnings |
| 2 | + |
1 | 3 | import dpctl.tensor as dpt |
2 | 4 | import numpy |
3 | 5 | import pytest |
@@ -31,15 +33,15 @@ def test_asfarray2(self, dtype, data, data_dtype): |
31 | 33 | result = dpnp.asfarray(dpnp.array(data, dtype=data_dtype), dtype) |
32 | 34 | assert_array_equal(result, expected) |
33 | 35 |
|
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): |
37 | 37 | 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]) |
39 | 40 | assert_array_equal(result, expected) |
40 | 41 |
|
41 | 42 | 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) |
43 | 45 | assert_array_equal(result, expected) |
44 | 46 |
|
45 | 47 |
|
|
0 commit comments