summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2022-01-19 14:10:10 -0600
committerSebastian Berg <sebastian@sipsolutions.net>2022-01-19 14:14:27 -0600
commit5d98d672a85421ecdc2d20c7f0a74003eaff004d (patch)
tree7a11baa2533d67cf97df598a19d68e4f158ae6fb /numpy/lib/tests
parent9f9d755c9ab68a9ef3a5ffee8ea30d6a837732c1 (diff)
downloadnumpy-5d98d672a85421ecdc2d20c7f0a74003eaff004d.tar.gz
TST: Skip unparsable field error tests on PyPy
PyPy has a small bug with error formatting, so these cause it to crash. Simply skip the tests on old PyPy versions for now. (Matti fixed the issue long ago, just waiting for a new PyPy release :))
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_io.py6
-rw-r--r--numpy/lib/tests/test_loadtxt.py16
2 files changed, 21 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index 37404cb41..a2758123b 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -779,6 +779,8 @@ class TestLoadTxt(LoadTxtBase):
a = np.array([[1, 2, 3], [4, 5, 6]], int)
assert_array_equal(x, a)
+ @pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+ reason="PyPy bug in error formatting")
def test_comments_multi_chars(self):
c = TextIO()
c.write('/* comment\n1,2,3,5\n')
@@ -995,6 +997,8 @@ class TestLoadTxt(LoadTxtBase):
c, dtype=dt, converters=float.fromhex, encoding="latin1")
assert_equal(res, tgt, err_msg="%s" % dt)
+ @pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+ reason="PyPy bug in error formatting")
def test_default_float_converter_no_default_hex_conversion(self):
"""
Ensure that fromhex is only used for values with the correct prefix and
@@ -1005,6 +1009,8 @@ class TestLoadTxt(LoadTxtBase):
match=".*convert string 'a' to float64 at row 0, column 1"):
np.loadtxt(c)
+ @pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+ reason="PyPy bug in error formatting")
def test_default_float_converter_exception(self):
"""
Ensure that the exception message raised during failed floating point
diff --git a/numpy/lib/tests/test_loadtxt.py b/numpy/lib/tests/test_loadtxt.py
index 0ebcf12dc..df88cef95 100644
--- a/numpy/lib/tests/test_loadtxt.py
+++ b/numpy/lib/tests/test_loadtxt.py
@@ -11,7 +11,7 @@ from io import StringIO
import numpy as np
from numpy.ma.testutils import assert_equal
-from numpy.testing import assert_array_equal, HAS_REFCOUNT
+from numpy.testing import assert_array_equal, HAS_REFCOUNT, IS_PYPY
def test_scientific_notation():
@@ -200,6 +200,8 @@ def test_maxrows_no_blank_lines(dtype):
assert_equal(res, np.array([["1.5", "2.5"], ["3.0", "4.0"]], dtype=dtype))
+@pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+ reason="PyPy bug in error formatting")
@pytest.mark.parametrize("dtype", (np.dtype("f8"), np.dtype("i2")))
def test_exception_message_bad_values(dtype):
txt = StringIO("1,2\n3,XXX\n5,6")
@@ -381,6 +383,8 @@ def test_bool():
assert_array_equal(res.view(np.uint8), [[1, 0], [1, 1]])
+@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"])
def test_integer_signs(dtype):
dtype = np.dtype(dtype)
@@ -396,6 +400,8 @@ def test_integer_signs(dtype):
np.loadtxt([f"{sign}2\n"], dtype=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"])
def test_implicit_cast_float_to_int_fails(dtype):
txt = StringIO("1.0, 2.1, 3.7\n4, 5, 6")
@@ -466,6 +472,8 @@ def test_object_cleanup_on_read_error():
assert sys.getrefcount(sentinel) == 2
+@pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+ reason="PyPy bug in error formatting")
def test_character_not_bytes_compatible():
"""Test exception when a character cannot be encoded as 'S'."""
data = StringIO("–") # == \u2013
@@ -688,6 +696,8 @@ def test_unicode_whitespace_stripping_complex(dtype):
assert_array_equal(res, np.array([[1, 2+3j, 4+5j, 6-7j, 8j, 9j]] * 2))
+@pytest.mark.skipif(IS_PYPY and sys.implementation.version <= (7, 3, 8),
+ reason="PyPy bug in error formatting")
@pytest.mark.parametrize("dtype", "FD")
@pytest.mark.parametrize("field",
["1 +2j", "1+ 2j", "1+2 j", "1+-+3", "(1j", "(1", "(1+2j", "1+2j)"])
@@ -696,6 +706,8 @@ def test_bad_complex(dtype, field):
np.loadtxt([field + "\n"], dtype=dtype, delimiter=",")
+@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"] + "efgdFDG" + "?")
def test_nul_character_error(dtype):
@@ -707,6 +719,8 @@ def test_nul_character_error(dtype):
np.loadtxt(["1\000"], dtype=dtype, delimiter=",", quotechar='"')
+@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"] + "efgdFDG" + "?")
def test_no_thousands_support(dtype):