[python-hdf5storage] 23/84: Fixed bug in tests where the partial squeezing of singleton arrays was not detected when no metadata was written.
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:24:59 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag 0.1.10
in repository python-hdf5storage.
commit b1c9976ac8f17b2ba7e62bd4613ad3274d2bafa5
Author: Freja Nordsiek <fnordsie at gmail.com>
Date: Sun Sep 14 20:47:27 2014 -0400
Fixed bug in tests where the partial squeezing of singleton arrays was not detected when no metadata was written.
---
tests/asserts.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/tests/asserts.py b/tests/asserts.py
index eba40e1..c90f49a 100644
--- a/tests/asserts.py
+++ b/tests/asserts.py
@@ -135,7 +135,16 @@ def assert_equal_none_format(a, b):
npt.assert_equal(a, b)
else:
assert a.dtype == b.dtype
- assert a.shape == b.shape
+ # Now, if b.shape is just all ones, then a.shape will
+ # just be (1,). Otherwise, we need to compare the shapes
+ # directly. Also, dimensions need to be squeezed before
+ # comparison in this case.
+ assert np.prod(a.shape) == np.prod(b.shape)
+ assert a.shape == b.shape \
+ or (np.prod(b.shape) == 1 and a.shape == (1,))
+ if np.prod(a.shape) == 1:
+ a = np.squeeze(a)
+ b = np.squeeze(b)
npt.assert_equal(a, b)
else:
assert a.dtype == b.dtype
--
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