diff --git a/INSTALL.rst.txt b/INSTALL.rst.txt index d6c42bad7ea7..0c4b842b877e 100644 --- a/INSTALL.rst.txt +++ b/INSTALL.rst.txt @@ -33,8 +33,13 @@ Building NumPy requires the following installed software: This is required for testing numpy, but not for using it. +4) hypothesis__ (optional) + + This is required for testing numpy, but not for using it. + Python__ http://www.python.org pytest__ http://pytest.readthedocs.io +hypothesis__ https://hypothesis.readthedocs.io .. note:: diff --git a/numpy/core/tests/test_arrayprint.py b/numpy/core/tests/test_arrayprint.py index 702e68e769f0..0dbd8fc78029 100644 --- a/numpy/core/tests/test_arrayprint.py +++ b/numpy/core/tests/test_arrayprint.py @@ -12,6 +12,10 @@ ) import textwrap +import hypothesis +import hypothesis.extra.numpy + + class TestArrayRepr(object): def test_nan_inf(self): x = np.array([np.nan, np.inf]) @@ -399,6 +403,16 @@ def test_wide_element(self): "[ 'xxxxx']" ) + @hypothesis.seed(43) + @hypothesis.given(hypothesis.extra.numpy.from_dtype(np.dtype("U"))) + def test_any_text(self, text): + a = np.array([text, text, text]) + assert_equal(a[0], text) + assert_equal( + np.array2string(a, max_line_width=len(repr(text)) * 2 + 3), + "[{0!r} {0!r}\n {0!r}]".format(text) + ) + @pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts") def test_refcount(self): # make sure we do not hold references to the array due to a recursive diff --git a/test_requirements.txt b/test_requirements.txt index 627150673a40..e912bafc15ce 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,4 +1,5 @@ cython==0.29.14 +hypothesis==4.53.1 pytest==5.3.1 pytz==2019.3 pytest-cov==2.8.1