From a7a30016a946beef8e2c5a1860222dfbc2a60a18 Mon Sep 17 00:00:00 2001 From: Luke Carmichael Date: Fri, 8 Nov 2013 17:08:25 -0500 Subject: test for failing chunk read of large string --- numpy/lib/tests/test_format.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'numpy/lib/tests/test_format.py') diff --git a/numpy/lib/tests/test_format.py b/numpy/lib/tests/test_format.py index 91643e559..1dea316bc 100644 --- a/numpy/lib/tests/test_format.py +++ b/numpy/lib/tests/test_format.py @@ -428,6 +428,9 @@ def test_roundtrip(): arr2 = roundtrip(arr) yield assert_array_equal, arr, arr2 +def test_long_str(): + long_str_arr = np.empty(10, dtype='S279291') + long_str_arr2 = roundtrip(long_str_arr) @dec.slow def test_memmap_roundtrip(): -- cgit v1.2.1 From 83eb3ac0658d5e71d9860f8b1e37f285ec19c692 Mon Sep 17 00:00:00 2001 From: Luke Carmichael Date: Fri, 8 Nov 2013 20:02:15 -0500 Subject: BUG: Fix chunked reading of strings longer than BUFFERSIZE This fix correctly calculates the number of BUFFER_SIZE chunks to read. This fix takes into account dtype sizes that could be larger than the BUFFER_SIZE, like a long string. See #4027 --- numpy/lib/tests/test_format.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib/tests/test_format.py') diff --git a/numpy/lib/tests/test_format.py b/numpy/lib/tests/test_format.py index 1dea316bc..485947764 100644 --- a/numpy/lib/tests/test_format.py +++ b/numpy/lib/tests/test_format.py @@ -429,7 +429,7 @@ def test_roundtrip(): yield assert_array_equal, arr, arr2 def test_long_str(): - long_str_arr = np.empty(10, dtype='S279291') + long_str_arr = np.ones(1, dtype=np.dtype((str, format.BUFFER_SIZE+1))) long_str_arr2 = roundtrip(long_str_arr) @dec.slow -- cgit v1.2.1