[python-hdf5storage] 04/12: Modified tests to work with real/complex numbers that have NaN part/s.
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:24:48 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag 0.1.1
in repository python-hdf5storage.
commit 4fd84305fa3d07b1ffc57a6fafc8b2173d1a5b52
Author: Freja Nordsiek <fnordsie at gmail.com>
Date: Fri Mar 7 17:49:08 2014 -0500
Modified tests to work with real/complex numbers that have NaN part/s.
---
tests/asserts.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tests/asserts.py b/tests/asserts.py
index 6033d7b..c8d945a 100644
--- a/tests/asserts.py
+++ b/tests/asserts.py
@@ -54,7 +54,13 @@ def assert_equal(a, b):
for index in range(0, len(a)):
assert_equal(a[index], b[index])
elif not isinstance(b, (np.generic, np.ndarray)):
- assert a == b
+ if isinstance(b, complex):
+ assert a.real == b.real \
+ or np.all(np.isnan([a.real, b.real]))
+ assert a.imag == b.imag \
+ or np.all(np.isnan([a.imag, b.imag]))
+ else:
+ assert a == b or np.all(np.isnan([a, b]))
else:
assert a.dtype == b.dtype
assert a.shape == b.shape
--
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