|
4 | 4 | import numpy
|
5 | 5 |
|
6 | 6 |
|
7 |
| -@pytest.mark.parametrize("type", |
| 7 | +@pytest.mark.parametrize("dtype", |
8 | 8 | [numpy.float64, numpy.float32, numpy.int64, numpy.int32],
|
9 |
| - ids=['float64', 'float32', 'int64', 'int32']) |
10 |
| -@pytest.mark.parametrize("input", |
11 |
| - [[1, 2, 3], [1., 2., 3.], dpnp.array([1, 2, 3]), dpnp.array([1., 2., 3.])], |
12 |
| - ids=['intlist', 'floatlist', 'intarray', 'floatarray']) |
13 |
| -def test_asfarray(type, input): |
14 |
| - np_res = numpy.asfarray(input, type) |
15 |
| - dpnp_res = dpnp.asfarray(input, type) |
16 |
| - |
17 |
| - numpy.testing.assert_array_equal(dpnp_res, np_res) |
| 9 | + ids=["float64", "float32", "int64", "int32"]) |
| 10 | +@pytest.mark.parametrize("data", |
| 11 | + [[1, 2, 3], [1., 2., 3.]], |
| 12 | + ids=["[1, 2, 3]", "[1., 2., 3.]"]) |
| 13 | +def test_asfarray(dtype, data): |
| 14 | + expected = numpy.asfarray(data, dtype) |
| 15 | + result = dpnp.asfarray(data, dtype) |
| 16 | + |
| 17 | + numpy.testing.assert_array_equal(result, expected) |
| 18 | + |
| 19 | + |
| 20 | +@pytest.mark.parametrize("dtype", |
| 21 | + [numpy.float64, numpy.float32, numpy.int64, numpy.int32], |
| 22 | + ids=["float64", "float32", "int64", "int32"]) |
| 23 | +@pytest.mark.parametrize("data", |
| 24 | + [[1, 2, 3], [1., 2., 3.]], |
| 25 | + ids=["[1, 2, 3]", "[1., 2., 3.]"]) |
| 26 | +def test_asfarray2(dtype, data): |
| 27 | + expected = numpy.asfarray(numpy.array(data), dtype) |
| 28 | + result = dpnp.asfarray(dpnp.array(data), dtype) |
| 29 | + |
| 30 | + numpy.testing.assert_array_equal(result, expected) |
18 | 31 |
|
19 | 32 |
|
20 | 33 | class TestConcatenate:
|
|
0 commit comments