Skip to content

Commit 6be6284

Browse files
committed
testing shape
1 parent a28d591 commit 6be6284

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

wolframclient/tests/serializers/wxf_pythonarray.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,24 @@
99

1010

1111
class TestCase(BaseTestCase):
12+
1213
def test_python_array(self):
1314

1415
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"),
2021
):
2122

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

Comments
 (0)