[Scipy-svn] r5580 - trunk/scipy/io/matlab/tests

scipy-svn@scip... scipy-svn@scip...
Fri Feb 20 13:40:25 CST 2009


Author: matthew.brett@gmail.com
Date: 2009-02-20 13:40:23 -0600 (Fri, 20 Feb 2009)
New Revision: 5580

Modified:
   trunk/scipy/io/matlab/tests/test_mio.py
Log:
Expanded tests somewhat

Modified: trunk/scipy/io/matlab/tests/test_mio.py
===================================================================
--- trunk/scipy/io/matlab/tests/test_mio.py	2009-02-20 04:10:47 UTC (rev 5579)
+++ trunk/scipy/io/matlab/tests/test_mio.py	2009-02-20 19:40:23 UTC (rev 5580)
@@ -191,12 +191,12 @@
 case_table5_rt.append(
     {'name': 'objectarray',
      'expected': {'testobjectarray': np.repeat(MO, 2).reshape(1,2)}})
-''' Test fails;  consider also savemat('A', {'A':np.array(1, dtype=object)})
+objarr = np.empty((1,1),dtype=object)
+objarr[0,0] = mlarr(1)
 case_table5_rt.append(
     {'name': 'scalarobject',
-    'expected': {'testscalarobject': mlarr(1, dtype=object)}
-    })
-'''
+     'expected': {'testscalarobject': objarr}
+     })
 
 
 def types_compatible(var1, var2):
@@ -513,3 +513,19 @@
     vals = loadmat(stream)
     yield assert_array_equal, vals['arr'], arr
     yield assert_true, raw_len>compressed_len
+    # Concatenate, test later
+    arr2 = arr.copy()
+    arr2[0,0] = 1
+    stream = StringIO()
+    savemat(stream, {'arr':arr, 'arr2':arr2}, do_compression=False)
+    vals = loadmat(stream)
+    yield assert_array_equal, vals['arr2'], arr2
+    stream = StringIO()
+    savemat(stream, {'arr':arr, 'arr2':arr2}, do_compression=True)
+    vals = loadmat(stream)
+    yield assert_array_equal, vals['arr2'], arr2
+    
+
+def test_single_object():
+    stream = StringIO()
+    savemat(stream, {'A':np.array(1, dtype=object)})



More information about the Scipy-svn mailing list