[python-hdf5storage] 65/152: Added numpy bool read writeback tests.
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:24:35 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag 0.1
in repository python-hdf5storage.
commit 32468974b83c237d3bc49f3aa8916634c12471a6
Author: Freja Nordsiek <fnordsie at gmail.com>
Date: Thu Jan 30 00:55:53 2014 -0500
Added numpy bool read writeback tests.
---
tests/test_write_readback.py | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/tests/test_write_readback.py b/tests/test_write_readback.py
index af58360..a68d1d7 100755
--- a/tests/test_write_readback.py
+++ b/tests/test_write_readback.py
@@ -53,8 +53,11 @@ class TestWriteReadbackCpythonMatlab(unittest.TestCase):
def random_numpy(self, shape, dtype):
nbytes = np.ndarray(shape=(1,), dtype=dtype).nbytes
- return np.ndarray(shape=shape, dtype=dtype,
- buffer=np.random.bytes(nbytes*np.prod(shape)))
+ bts = np.random.bytes(nbytes * np.prod(shape))
+ if dtype == 'bool':
+ bts = b''.join([{True: b'\x01', False: b'\x00'}[ \
+ ch > 127] for ch in bts])
+ return np.ndarray(shape=shape, dtype=dtype, buffer=bts)
def random_numpy_scalar(self, dtype):
return self.random_numpy(tuple(), dtype)[()]
@@ -202,6 +205,9 @@ class TestWriteReadbackCpythonMatlab(unittest.TestCase):
self.options)
self.assert_equal_numpy(data, out)
+ def test_numpy_bool_scalar(self):
+ self.t_numpy_scalar('bool')
+
def test_numpy_uint8_scalar(self):
self.t_numpy_scalar('uint8')
@@ -241,6 +247,9 @@ class TestWriteReadbackCpythonMatlab(unittest.TestCase):
def test_numpy_complex128_scalar(self):
self.t_numpy_scalar('complex128')
+ def test_numpy_bool(self):
+ self.t_numpy('bool')
+
def test_numpy_uint8(self):
self.t_numpy('uint8')
@@ -280,6 +289,9 @@ class TestWriteReadbackCpythonMatlab(unittest.TestCase):
def test_numpy_complex128(self):
self.t_numpy('complex128')
+ def test_numpy_bool_empty(self):
+ self.t_numpy_empty('bool')
+
def test_numpy_uint8_empty(self):
self.t_numpy_empty('uint8')
--
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