diff options
author | Lars G <lagru@mailbox.org> | 2018-09-15 22:19:43 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-09-17 02:05:48 -0700 |
commit | 324e3045c3e5a4c262e9d231663b7228593c8675 (patch) | |
tree | 54f46c5df3e0fa2ccfe51d71279cc4c802a08871 /numpy/lib/tests/test_arraypad.py | |
parent | 87131155b86b221e63cf8d9ead61490a59e3db53 (diff) | |
download | numpy-324e3045c3e5a4c262e9d231663b7228593c8675.tar.gz |
TST: Add a regression test for gh-11216
The test is marked xfail right now as it is not fixed in master
Diffstat (limited to 'numpy/lib/tests/test_arraypad.py')
-rw-r--r-- | numpy/lib/tests/test_arraypad.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_arraypad.py b/numpy/lib/tests/test_arraypad.py index 55c917156..581ae30e5 100644 --- a/numpy/lib/tests/test_arraypad.py +++ b/numpy/lib/tests/test_arraypad.py @@ -3,8 +3,11 @@ """ from __future__ import division, absolute_import, print_function +import pytest + import numpy as np -from numpy.testing import (assert_array_equal, assert_raises, assert_allclose,) +from numpy.testing import (assert_array_equal, assert_raises, assert_allclose, + assert_equal) from numpy.lib import pad @@ -344,6 +347,20 @@ class TestStatistic(object): ) assert_array_equal(a, b) + @pytest.mark.parametrize("mode", [ + pytest.param("mean", marks=pytest.mark.xfail(reason="gh-11216")), + "median", + "minimum", + "maximum" + ]) + def test_same_prepend_append(self, mode): + """ Test that appended and prepended values are equal """ + # This test is constructed to trigger floating point rounding errors in + # a way that caused gh-11216 for mode=='mean' + a = np.array([-1, 2, -1]) + np.array([0, 1e-12, 0], dtype=np.float64) + a = np.pad(a, (1, 1), mode) + assert_equal(a[0], a[-1]) + class TestConstant(object): def test_check_constant(self): |