summaryrefslogtreecommitdiff
path: root/numpy/lib
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2022-06-09 13:13:52 -0700
committerSebastian Berg <sebastian@sipsolutions.net>2022-06-09 13:20:22 -0700
commitf725d80ad8fbbbc85698052ca62fd58b581f5e7f (patch)
tree081929e0fea0a54e839825a100ab0a62a416e581 /numpy/lib
parent368baf45d023084798231e5abd0135783a2fc7c6 (diff)
downloadnumpy-f725d80ad8fbbbc85698052ca62fd58b581f5e7f.tar.gz
TST: Fixup loadtxt int-via-float tests when in release mode
In release mode, the DeprecationWarning is not automatically raised, so we need to ensure this using a warning filter. (Also add missing metadata/info to the deprecation tests) Closes gh-21706
Diffstat (limited to 'numpy/lib')
-rw-r--r--numpy/lib/tests/test_loadtxt.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_loadtxt.py b/numpy/lib/tests/test_loadtxt.py
index f50e3b8ad..8839ef0a8 100644
--- a/numpy/lib/tests/test_loadtxt.py
+++ b/numpy/lib/tests/test_loadtxt.py
@@ -390,6 +390,7 @@ def test_bool():
@pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
reason="PyPy bug in error formatting")
@pytest.mark.parametrize("dtype", np.typecodes["AllInteger"])
+@pytest.mark.filterwarnings("error:.*integer via a float.*:DeprecationWarning")
def test_integer_signs(dtype):
dtype = np.dtype(dtype)
assert np.loadtxt(["+2"], dtype=dtype) == 2
@@ -407,6 +408,7 @@ def test_integer_signs(dtype):
@pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
reason="PyPy bug in error formatting")
@pytest.mark.parametrize("dtype", np.typecodes["AllInteger"])
+@pytest.mark.filterwarnings("error:.*integer via a float.*:DeprecationWarning")
def test_implicit_cast_float_to_int_fails(dtype):
txt = StringIO("1.0, 2.1, 3.7\n4, 5, 6")
with pytest.raises(ValueError):