summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_format.py
diff options
context:
space:
mode:
authorMax Sperlich <max.sperlich@livingsocial.com>2013-12-11 21:35:50 -0500
committerMax Sperlich <max.sperlich@livingsocial.com>2013-12-11 21:35:50 -0500
commite09c5f040fa020bb47c6610356214c0477c206aa (patch)
tree37b2370e0cf5520c39ed231ccb5c93a5dbaade0b /numpy/lib/tests/test_format.py
parentbdb6f8cabf755d4d7b18a3d7e7475480ce6fc008 (diff)
downloadnumpy-e09c5f040fa020bb47c6610356214c0477c206aa.tar.gz
MAINT: Introduced _read_array function
This wrapper function is used everywhere in format.py now to ensure to correctly the handle the case when fp.read returns fewer bytes than requested. Also added a test for the orignal bug, loading an array of size more than 64K from a zip file.
Diffstat (limited to 'numpy/lib/tests/test_format.py')
-rw-r--r--numpy/lib/tests/test_format.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_format.py b/numpy/lib/tests/test_format.py
index abb93fbd5..dbcdaaaa6 100644
--- a/numpy/lib/tests/test_format.py
+++ b/numpy/lib/tests/test_format.py
@@ -517,6 +517,14 @@ def test_memmap_roundtrip():
del ma
+def test_compressed_roundtrip():
+ arr = np.random.rand(200, 200)
+ npz_file = os.path.join(tempdir, 'compressed.npz')
+ np.savez_compressed(npz_file, arr=arr)
+ arr1 = np.load(npz_file)['arr']
+ assert_array_equal(arr, arr1)
+
+
def test_write_version_1_0():
f = BytesIO()
arr = np.arange(1)