diff options
author | kai-striega <kaistriega@gmail.com> | 2020-01-12 14:33:00 +0800 |
---|---|---|
committer | kai-striega <kaistriega@gmail.com> | 2020-01-12 14:33:00 +0800 |
commit | 28bf9efaea2efe70838ec866645761172901cf57 (patch) | |
tree | ec20d7998652cb0a3637d2969a4034c2b4cabc1b /numpy | |
parent | c9fd0e7c1e077d3044b4f2cd419b89c8bf0544c7 (diff) | |
download | numpy-28bf9efaea2efe70838ec866645761172901cf57.tar.gz |
TST: fix NameError in clip nan propogation tests
The test expects parameters `arr`, `amin` and `amax`. However it then
uses `a`, `amin` and `amax` resulting in a `NameError`. This error was
not caught as the test was marked with xfail.
This commit changes `a` -> `arr` removing the NameError. Further it
adds precautions against similar errors requiring the error to be an
AssertionError and making the test strict.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/tests/test_numeric.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/numpy/core/tests/test_numeric.py b/numpy/core/tests/test_numeric.py index 934f0a2fd..7be2af8dd 100644 --- a/numpy/core/tests/test_numeric.py +++ b/numpy/core/tests/test_numeric.py @@ -1991,7 +1991,9 @@ class TestClip: actual = np.clip(arr, amin, amax) assert_equal(actual, exp) - @pytest.mark.xfail(reason="no scalar nan propagation yet") + @pytest.mark.xfail(reason="no scalar nan propagation yet", + raises=AssertionError, + strict=True) @pytest.mark.parametrize("arr, amin, amax", [ # problematic scalar nan case from hypothesis (np.zeros(10, dtype=np.int64), @@ -2001,10 +2003,10 @@ class TestClip: def test_clip_scalar_nan_propagation(self, arr, amin, amax): # enforcement of scalar nan propagation for comparisons # called through clip() - expected = np.minimum(np.maximum(a, amin), amax) + expected = np.minimum(np.maximum(arr, amin), amax) with assert_warns(DeprecationWarning): actual = np.clip(arr, amin, amax) - assert_equal(actual, expected) + assert_equal(actual, expected) @pytest.mark.xfail(reason="propagation doesn't match spec") @pytest.mark.parametrize("arr, amin, amax", [ |