summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-08-07 13:22:15 +0000
committerDavid Cournapeau <cournape@gmail.com>2009-08-07 13:22:15 +0000
commitd4001cfbfd953fd78e25df6ab32db845df3a90d8 (patch)
treedc0d99c786418dbcb01c92803936dafc74efb79e /numpy
parentfa317f76579b109d180c5f2ada1fd7787719d9df (diff)
downloadnumpy-d4001cfbfd953fd78e25df6ab32db845df3a90d8.tar.gz
Add unit test showing regression in stacked neighborhood iterator.
If a first neigh iterator n1 is created to that the neighborhood is strictly inside and smaller than the array, the second iterator on top of it will wrongly use n1 boundaries outside the neighborhood, even if still within the array.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/tests/test_multiarray.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index a45012771..133a67f3c 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -1354,5 +1354,15 @@ class TestStackedNeighborhoodIter(TestCase):
[-2, 2], NEIGH_MODE['circular'])
assert_array_equal(l, r)
+ # 4th simple, 1d test: stacking 2 neigh iterators, but with lower iterator
+ # being strictly within the array
+ def test_simple_strict_within(self):
+ dt = np.float64
+ # Stacking zero on top of mirror
+ x = np.array([1, 2, 3], dtype=dt)
+ r = [np.array([1, 2, 3], dtype=dt)]
+ l = test_neighborhood_iterator_oob(x, [1, 1], NEIGH_MODE['zero'],
+ [-1, 1], NEIGH_MODE['zero'])
+ assert_array_equal(l, r)
if __name__ == "__main__":
run_module_suite()