summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_format.py
diff options
context:
space:
mode:
authordrasmuss <daniel.rasmussen@appliedbrainresearch.com>2016-05-02 17:06:26 -0400
committerdrasmuss <daniel.rasmussen@appliedbrainresearch.com>2016-05-09 09:45:42 -0400
commitda668fc74653e5caae9f741461c4d20f9df6e5c1 (patch)
treeb0a29e85a6521e0126b13c86762b64ad8f8ae2e5 /numpy/lib/tests/test_format.py
parent1fc180b4c683e79649e5699303722995ca3e8ef9 (diff)
downloadnumpy-da668fc74653e5caae9f741461c4d20f9df6e5c1.tar.gz
BUG: Cast size to int64 when loading from archive
Prevents overflow errors for large arrays on systems where the default int type is int32.
Diffstat (limited to 'numpy/lib/tests/test_format.py')
-rw-r--r--numpy/lib/tests/test_format.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_format.py b/numpy/lib/tests/test_format.py
index a091ef5b3..46b21707f 100644
--- a/numpy/lib/tests/test_format.py
+++ b/numpy/lib/tests/test_format.py
@@ -836,5 +836,19 @@ def test_large_file_support():
assert_array_equal(r, d)
+@dec.slow
+def test_large_archive():
+ a = np.empty((2 ** 30, 2), dtype=np.uint8)
+ fname = os.path.join(tempdir, "large_archive")
+
+ with open(fname, "wb") as f:
+ np.savez(f, arr=a)
+
+ with open(fname, "rb") as f:
+ new_a = np.load(f)["arr"]
+
+ assert a.shape == new_a.shape
+
+
if __name__ == "__main__":
run_module_suite()