[Numpy-svn] r6456 - trunk/numpy/lib/tests

numpy-svn@scip... numpy-svn@scip...
Sun Feb 22 07:48:43 CST 2009


Author: stefan
Date: 2009-02-22 07:48:21 -0600 (Sun, 22 Feb 2009)
New Revision: 6456

Modified:
   trunk/numpy/lib/tests/test_io.py
Log:
Add test for Gzip loader.

Modified: trunk/numpy/lib/tests/test_io.py
===================================================================
--- trunk/numpy/lib/tests/test_io.py	2009-02-22 13:47:14 UTC (rev 6455)
+++ trunk/numpy/lib/tests/test_io.py	2009-02-22 13:48:21 UTC (rev 6456)
@@ -805,8 +805,22 @@
         self.failUnless(isinstance(test, np.recarray))
         assert_equal(test, control)
 
+def test_gzip_load():
+    import gzip
+    from StringIO import StringIO
 
+    a = np.random.random((5, 5))
 
+    s = StringIO()
+    f = gzip.GzipFile(fileobj=s, mode="w")
 
+    np.save(f, a)
+    f.close()
+    s.seek(0)
+
+    f = gzip.GzipFile(fileobj=s, mode="r")
+    assert_array_equal(np.load(f), a)
+
+
 if __name__ == "__main__":
     run_module_suite()



More information about the Numpy-svn mailing list