|
9 | 9 |
|
10 | 10 |
|
11 | 11 | class TestCase(BaseTestCase): |
| 12 | + |
12 | 13 | def test_python_array(self): |
13 | 14 |
|
14 | 15 | for array, numpy_type, wl_type in ( |
15 | | - ([1, 2, 3], numpy.int8, "Integer8"), |
16 | | - ([1, 2, 3], numpy.int32, "Integer32"), |
17 | | - ([1, 2, 3], numpy.int64, "Integer64"), |
18 | | - ([1.2, 2.3, 3], numpy.float32, "Real32"), |
19 | | - ([1.2, 2.3, 3], numpy.float64, "Real64"), |
| 16 | + ([1, 2, 3, 4, 5, 6], numpy.int8, "Integer8"), |
| 17 | + ([1, 2, 3, 4, 5, 6], numpy.int32, "Integer32"), |
| 18 | + ([1, 2, 3, 4, 5, 6], numpy.int64, "Integer64"), |
| 19 | + ([1.2, 2.3, 3, 4, 5, 6], numpy.float32, "Real32"), |
| 20 | + ([1.2, 2.3, 3, 4, 5, 6], numpy.float64, "Real64"), |
20 | 21 | ): |
21 | 22 |
|
22 | | - self.assertEqual( |
23 | | - export(numpy.array(array, numpy_type), target_format="wxf"), |
24 | | - export(PythonArray(array, wl_type), target_format="wxf"), |
25 | | - ) |
| 23 | + for shape in ((3, 2), None): |
| 24 | + |
| 25 | + arr = numpy.array(array, numpy_type) |
| 26 | + if shape: |
| 27 | + arr = arr.reshape(shape) |
| 28 | + |
| 29 | + self.assertEqual( |
| 30 | + export(arr, target_format="wxf"), |
| 31 | + export(PythonArray(array, wl_type, shape = shape), target_format="wxf"), |
| 32 | + ) |
0 commit comments