[python-dtcwt] 85/497: add test for integer input

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:05:52 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository python-dtcwt.

commit 8753bfc0a423cfe27dcbce83dca60d43a30bb021
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date:   Fri Aug 9 13:15:10 2013 +0100

    add test for integer input
    
    Integer input should be promoted to a floating point type. Check for
    this. See issue #7.
---
 tests/testxfm1.py | 6 ++++++
 tests/testxfm2.py | 6 ++++++
 tests/testxfm3.py | 6 ++++++
 3 files changed, 18 insertions(+)

diff --git a/tests/testxfm1.py b/tests/testxfm1.py
index 24f945e..0d709eb 100644
--- a/tests/testxfm1.py
+++ b/tests/testxfm1.py
@@ -51,4 +51,10 @@ def test_non_multiple_of_two():
 def test_2d():
     Yl, Yh = dtwavexfm(np.random.rand(10,10))
 
+def test_integer_input():
+    # Check that an integer input is correctly coerced into a floating point
+    # array
+    Yl, Yh = dtwavexfm([1,2,3,4])
+    assert np.any(Yl != 0)
+
 # vim:sw=4:sts=4:et
diff --git a/tests/testxfm2.py b/tests/testxfm2.py
index 8d6e96b..dbf05b4 100644
--- a/tests/testxfm2.py
+++ b/tests/testxfm2.py
@@ -61,4 +61,10 @@ def test_0_levels_w_scale():
     assert len(Yh) == 0
     assert len(Yscale) == 0
 
+def test_integer_input():
+    # Check that an integer input is correctly coerced into a floating point
+    # array
+    Yl, Yh = dtwavexfm2([[1,2,3,4], [1,2,3,4]])
+    assert np.any(Yl != 0)
+
 # vim:sw=4:sts=4:et
diff --git a/tests/testxfm3.py b/tests/testxfm3.py
index 2383418..5149acb 100644
--- a/tests/testxfm3.py
+++ b/tests/testxfm3.py
@@ -122,4 +122,10 @@ def test_simple_level_4_recon_ext_mode_4():
     assert crop_ellipsoid.size == ellipsoid_recon.size
     assert np.max(np.abs(crop_ellipsoid - ellipsoid_recon)) < TOLERANCE
 
+def test_integer_input():
+    # Check that an integer input is correctly coerced into a floating point
+    # array
+    Yl, Yh = dtwavexfm3(np.ones((4,4,4), dtype=np.int))
+    assert np.any(Yl != 0)
+
 # vim:sw=4:sts=4:et

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-dtcwt.git



More information about the debian-science-commits mailing list