summaryrefslogtreecommitdiff
path: root/numpy/polynomial/tests/test_polyutils.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2010-08-11 01:18:21 +0000
committerCharles Harris <charlesr.harris@gmail.com>2010-08-11 01:18:21 +0000
commit1994e4ae0f9e98c419793c7d3e6a079aa0c23010 (patch)
tree9c273e37488906d389b0ac496beb98378dbaf336 /numpy/polynomial/tests/test_polyutils.py
parent01362e33c84a2fb03d8b6ff66de866c2d1f9da95 (diff)
downloadnumpy-1994e4ae0f9e98c419793c7d3e6a079aa0c23010.tar.gz
BUG: Make mapdomain work for multidimensional arrays as advertized in
the documentation. Fixes ticket #1554.
Diffstat (limited to 'numpy/polynomial/tests/test_polyutils.py')
-rw-r--r--numpy/polynomial/tests/test_polyutils.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/numpy/polynomial/tests/test_polyutils.py b/numpy/polynomial/tests/test_polyutils.py
index 86f2a5b9b..14bf8bb78 100644
--- a/numpy/polynomial/tests/test_polyutils.py
+++ b/numpy/polynomial/tests/test_polyutils.py
@@ -67,9 +67,25 @@ class TestDomain(TestCase) :
dom1 = [0 - 1j, 2 + 1j]
dom2 = [-2, 2]
tgt = dom2
- res = pu.mapdomain(dom1, dom1, dom2)
+ x = dom1
+ res = pu.mapdomain(x, dom1, dom2)
assert_almost_equal(res, tgt)
+ # test for multidimensional arrays
+ dom1 = [0,4]
+ dom2 = [1,3]
+ tgt = np.array([dom2, dom2])
+ x = np.array([dom1, dom1])
+ res = pu.mapdomain(x, dom1, dom2)
+ assert_almost_equal(res, tgt)
+
+ # test that subtypes are preserved.
+ dom1 = [0,4]
+ dom2 = [1,3]
+ x = np.matrix([dom1, dom1])
+ res = pu.mapdomain(x, dom1, dom2)
+ assert_(isinstance(res, np.matrix))
+
def test_mapparms(self) :
# test for real values
dom1 = [0,4]