|
2 | 2 |
|
3 | 3 | from __future__ import absolute_import, print_function, unicode_literals |
4 | 4 |
|
5 | | -from functools import partial |
6 | | - |
| 5 | +from wolframclient.language.array import PythonArray |
7 | 6 | from wolframclient.serializers import export |
8 | 7 | from wolframclient.utils.api import numpy |
9 | | -from wolframclient.utils.pythonarray import PythonArray |
10 | 8 | from wolframclient.utils.tests import TestCase as BaseTestCase |
11 | 9 |
|
12 | 10 |
|
13 | 11 | class TestCase(BaseTestCase): |
14 | | - |
15 | | - export = partial(export, target_format="wl") |
16 | | - |
17 | 12 | def test_python_array(self): |
18 | 13 |
|
19 | | - for array, numpy_type, wl_type in (([1, 2, 3], numpy.uint64, "Integer64"),): |
20 | | - |
21 | | - print(self.export(numpy.array(array, numpy_type))) |
22 | | - print(self.export(PythonArray(array, wl_type))) |
| 14 | + 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"), |
| 20 | + ): |
| 21 | + |
| 22 | + self.assertEqual( |
| 23 | + export(numpy.array(array, numpy_type), target_format="wxf"), |
| 24 | + export(PythonArray(array, wl_type), target_format="wxf"), |
| 25 | + ) |
0 commit comments