[Scipy-svn] r2610 - trunk/Lib/io/tests

scipy-svn at scipy.org scipy-svn at scipy.org
Thu Jan 25 07:00:14 EST 2007


Author: matthew.brett at gmail.com
Date: 2007-01-25 05:59:47 -0600 (Thu, 25 Jan 2007)
New Revision: 2610

Modified:
   trunk/Lib/io/tests/test_npfile.py
Log:
Corrected C/F order tests

Modified: trunk/Lib/io/tests/test_npfile.py
===================================================================
--- trunk/Lib/io/tests/test_npfile.py	2007-01-24 23:37:12 UTC (rev 2609)
+++ trunk/Lib/io/tests/test_npfile.py	2007-01-25 11:59:47 UTC (rev 2610)
@@ -51,7 +51,11 @@
     def test_read_write(self):
         npf = npfile(StringIO())
         arr = N.reshape(N.arange(10), (5,2))
+        # Arr as read in fortran order
         f_arr = arr.reshape((2,5)).T
+        # Arr written in fortran order read in C order
+        cf_arr = arr.T.reshape((5,2))
+        # Byteswapped array
         bo = arr.dtype.byteorder
         swapped_code = sys_endian_code == '<' and '>' or '<'
         if bo in ['=', sys_endian_code]:
@@ -70,6 +74,11 @@
         npf.rewind()
         assert_array_equal(npf.read(shp, adt, order='F'),
                            f_arr)
+        npf.rewind()
+        npf.write(arr, order='F')
+        npf.rewind()
+        assert_array_equal(npf.read(shp, adt),
+                           cf_arr)
         
         npf = npfile(StringIO(), endian='swapped', order='F')
         npf.write(arr)
@@ -78,5 +87,5 @@
         npf.rewind()
         assert_array_equal(npf.read(shp, adt, endian='dtype'), bs_arr)
         npf.rewind()
-        # assert_array_equal(npf.read(shp, adt, order='C'), f_arr)
+        assert_array_equal(npf.read(shp, adt, order='C'), cf_arr)
         




More information about the Scipy-svn mailing list