diff options
| author | Sebastian Berg <sebastianb@nvidia.com> | 2022-11-17 15:21:30 +0100 |
|---|---|---|
| committer | Sebastian Berg <sebastianb@nvidia.com> | 2022-11-17 15:21:30 +0100 |
| commit | 424cb3fa1fd7c1aa10aaa55c195f0ef7091fc71f (patch) | |
| tree | fb09cc22db3fea0e5fe87bb74eb8c7e4bf11a29b | |
| parent | 8b13c8cecf8f049736c33e1a500da0e411b06b53 (diff) | |
| download | numpy-424cb3fa1fd7c1aa10aaa55c195f0ef7091fc71f.tar.gz | |
BUG: Fixup warning giving and remove MachAr from docs
| -rw-r--r-- | doc/source/reference/routines.dtype.rst | 1 | ||||
| -rw-r--r-- | numpy/__init__.py | 4 | ||||
| -rw-r--r-- | numpy/core/tests/test_deprecations.py | 3 |
3 files changed, 4 insertions, 4 deletions
diff --git a/doc/source/reference/routines.dtype.rst b/doc/source/reference/routines.dtype.rst index e9189ca07..6cb036031 100644 --- a/doc/source/reference/routines.dtype.rst +++ b/doc/source/reference/routines.dtype.rst @@ -30,7 +30,6 @@ Data type information finfo iinfo - MachAr Data type testing ----------------- diff --git a/numpy/__init__.py b/numpy/__init__.py index fc0d4437e..a756d07a8 100644 --- a/numpy/__init__.py +++ b/numpy/__init__.py @@ -262,9 +262,9 @@ else: # And future warnings for those that will change, but also give # the AttributeError warnings.warn( - "In the future the attribute `%s` will be defined as the " + f"In the future `np.{attr}` will be defined as the " "corresponding NumPy scalar. (This may have returned Python " - "scalars in past versions.", FutureWarning) + "scalars in past versions.", FutureWarning, stacklevel=2) # Importing Tester requires importing all of UnitTest which is not a # cheap import Since it is mainly used in test suits, we lazy import it diff --git a/numpy/core/tests/test_deprecations.py b/numpy/core/tests/test_deprecations.py index 53f4fc4cf..dba301418 100644 --- a/numpy/core/tests/test_deprecations.py +++ b/numpy/core/tests/test_deprecations.py @@ -1169,7 +1169,8 @@ class TestDeprecatedGlobals(_DeprecationTestCase): def test_future_scalar_attributes(name): # FutureWarning added 2022-11-17, NumPy 1.24, assert name not in dir(np) # we may want to not add them - with pytest.warns(FutureWarning): + with pytest.warns(FutureWarning, + match=f"In the future .*{name}"): assert not hasattr(np, name) # Unfortunately, they are currently still valid via `np.dtype()` |
