[python-hdf5storage] 04/13: Added tests for writing and reading back numpy matrix.
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:25:24 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag 0.1.12
in repository python-hdf5storage.
commit 7902c1ffd0ae9b27c44607d5f8f8fb829d48b910
Author: Freja Nordsiek <fnordsie at gmail.com>
Date: Sat Feb 13 20:01:47 2016 +0100
Added tests for writing and reading back numpy matrix.
---
tests/test_write_readback.py | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/tests/test_write_readback.py b/tests/test_write_readback.py
index 3eb52cc..71b9a9e 100644
--- a/tests/test_write_readback.py
+++ b/tests/test_write_readback.py
@@ -148,7 +148,16 @@ class TestPythonMatlabFormat(object):
out = self.write_readback(data, random_name(),
self.options)
self.assert_equal(out, data)
-
+
+ def check_numpy_matrix(self, dtype):
+ # Makes a random numpy array of the given type, converts it to
+ # a matrix, writes it and reads it back, and then compares it.
+ shape = random_numpy_shape(2, max_array_axis_length)
+ data = np.matrix(random_numpy(shape, dtype))
+ out = self.write_readback(data, random_name(),
+ self.options)
+ self.assert_equal(out, data)
+
def check_python_collection(self, tp):
# Makes a random collection of the specified type, writes it and
# reads it back, and then compares it.
@@ -322,6 +331,12 @@ class TestPythonMatlabFormat(object):
for dt in dts:
yield self.check_numpy_array, dt, 3
+ def test_numpy_matrix(self):
+ dts = copy.deepcopy(self.dtypes)
+ dts.append('object')
+ for dt in dts:
+ yield self.check_numpy_matrix, dt
+
def test_numpy_empty(self):
for dt in self.dtypes:
yield self.check_numpy_empty, dt
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-hdf5storage.git
More information about the debian-science-commits
mailing list