diff options
author | chiffa <ank@andreikucharavy.com> | 2016-02-27 17:39:29 -0500 |
---|---|---|
committer | chiffa <andrei.chiffa136@gmail.com> | 2016-02-27 20:39:56 -0500 |
commit | 8f64328991fa32e02a45e15edebdff8c3245db5f (patch) | |
tree | c08f83ac4847100352f4eab19c336c2cd928a79f /numpy/lib/tests/test_arraypad.py | |
parent | 140552df7c5554742de2caf01b26676010134bde (diff) | |
download | numpy-8f64328991fa32e02a45e15edebdff8c3245db5f.tar.gz |
TST: added a test for constant padding on 4 sides of a 2d array
This test exposes padding bug described in the issue #7353
Diffstat (limited to 'numpy/lib/tests/test_arraypad.py')
-rw-r--r-- | numpy/lib/tests/test_arraypad.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_arraypad.py b/numpy/lib/tests/test_arraypad.py index f19a0b13a..9ad05906d 100644 --- a/numpy/lib/tests/test_arraypad.py +++ b/numpy/lib/tests/test_arraypad.py @@ -477,6 +477,19 @@ class TestConstant(TestCase): ) assert_allclose(test, expected) + def test_check_constant_pad_2d(self): + arr = np.arange(4).reshape(2, 2) + test = np.lib.pad(arr, ((1, 2), (1, 3)), mode='constant', + constant_values=((1, 2), (3, 4))) + expected = np.array( + [[3, 1, 1, 4, 4, 4], + [3, 0, 1, 4, 4, 4], + [3, 2, 3, 4, 4, 4], + [3, 2, 2, 4, 4, 4], + [3, 2, 2, 4, 4, 4]] + ) + assert_allclose(test, expected) + class TestLinearRamp(TestCase): def test_check_simple(self): |