diff options
| author | Eric Wieser <wieser.eric@gmail.com> | 2020-08-24 13:14:17 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-24 13:14:17 +0100 |
| commit | 018fb37987e02fdba377b008e5ca3d68e4611cb2 (patch) | |
| tree | 5288e8bc6b1c01ddaae982e4659fb51b43cded38 /numpy/lib | |
| parent | 117b3f4a293c689777d3cd445969ca99acb01cfe (diff) | |
| parent | fa45695b787070275696e979eb9f476ef3afc5e6 (diff) | |
| download | numpy-018fb37987e02fdba377b008e5ca3d68e4611cb2.tar.gz | |
Merge branch 'master' into cleanup-Long
Diffstat (limited to 'numpy/lib')
| -rw-r--r-- | numpy/lib/arraysetops.py | 6 | ||||
| -rw-r--r-- | numpy/lib/function_base.py | 4 | ||||
| -rw-r--r-- | numpy/lib/tests/test_financial_expired.py | 13 |
3 files changed, 12 insertions, 11 deletions
diff --git a/numpy/lib/arraysetops.py b/numpy/lib/arraysetops.py index df9a110c5..6a2ad004c 100644 --- a/numpy/lib/arraysetops.py +++ b/numpy/lib/arraysetops.py @@ -278,7 +278,7 @@ def unique(ar, return_index=False, return_inverse=False, ar = np.moveaxis(ar, axis, 0) except np.AxisError: # this removes the "axis1" or "axis2" prefix from the error message - raise np.AxisError(axis, ar.ndim) + raise np.AxisError(axis, ar.ndim) from None # Must reshape to a contiguous 2D array for this to work... orig_shape, orig_dtype = ar.shape, ar.dtype @@ -300,10 +300,10 @@ def unique(ar, return_index=False, return_inverse=False, # array with shape `(len(ar),)`. Because `dtype` in this case has # itemsize 0, the total size of the result is still 0 bytes. consolidated = np.empty(len(ar), dtype=dtype) - except TypeError: + except TypeError as e: # There's no good way to do this for object arrays, etc... msg = 'The axis argument to unique is not supported for dtype {dt}' - raise TypeError(msg.format(dt=ar.dtype)) + raise TypeError(msg.format(dt=ar.dtype)) from e def reshape_uniq(uniq): n = len(uniq) diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 556227c0d..0db00a0f2 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -1991,8 +1991,8 @@ class vectorize: .. versionadded:: 1.7.0 cache : bool, optional - If `True`, then cache the first function call that determines the number - of outputs if `otypes` is not provided. + If `True`, then cache the first function call that determines the number + of outputs if `otypes` is not provided. .. versionadded:: 1.7.0 diff --git a/numpy/lib/tests/test_financial_expired.py b/numpy/lib/tests/test_financial_expired.py index e1d05da0c..66bb08026 100644 --- a/numpy/lib/tests/test_financial_expired.py +++ b/numpy/lib/tests/test_financial_expired.py @@ -3,10 +3,11 @@ import pytest import numpy as np +@pytest.mark.skipif(sys.version_info[:2] < (3, 7), + reason="requires python 3.7 or higher") def test_financial_expired(): - if sys.version_info[:2] >= (3, 7): - match = 'NEP 32' - else: - match = None - with pytest.raises(AttributeError, match=match): - np.fv + match = 'NEP 32' + with pytest.warns(RuntimeWarning, match=match): + func = np.fv + with pytest.raises(RuntimeError, match=match): + func(1, 2, 3) |
