summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/tests/test_deprecations.py6
-rw-r--r--numpy/lib/tests/test_loadtxt.py2
2 files changed, 8 insertions, 0 deletions
diff --git a/numpy/core/tests/test_deprecations.py b/numpy/core/tests/test_deprecations.py
index a10dacd49..2b7864433 100644
--- a/numpy/core/tests/test_deprecations.py
+++ b/numpy/core/tests/test_deprecations.py
@@ -1216,6 +1216,12 @@ class TestAxisNotMAXDIMS(_DeprecationTestCase):
class TestLoadtxtParseIntsViaFloat(_DeprecationTestCase):
+ # Deprecated 2022-07-03, NumPy 1.23
+ # This test can be removed without replacement after the deprecation.
+ # The tests:
+ # * numpy/lib/tests/test_loadtxt.py::test_integer_signs
+ # * lib/tests/test_loadtxt.py::test_implicit_cast_float_to_int_fails
+ # Have a warning filter that needs to be removed.
message = r"loadtxt\(\): Parsing an integer via a float is deprecated.*"
@pytest.mark.parametrize("dtype", np.typecodes["AllInteger"])
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):