[Scipy-svn] r6870 - in trunk/scipy/io/matlab: . tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Thu Nov 11 19:57:18 EST 2010
Author: matthew.brett at gmail.com
Date: 2010-11-11 18:57:18 -0600 (Thu, 11 Nov 2010)
New Revision: 6870
Modified:
trunk/scipy/io/matlab/mio5.py
trunk/scipy/io/matlab/tests/test_mio.py
trunk/scipy/io/matlab/tests/test_mio5_utils.py
Log:
FIX - fix python3 testing errors introduced by new tests
Modified: trunk/scipy/io/matlab/mio5.py
===================================================================
--- trunk/scipy/io/matlab/mio5.py 2010-11-12 00:57:02 UTC (rev 6869)
+++ trunk/scipy/io/matlab/mio5.py 2010-11-12 00:57:18 UTC (rev 6870)
@@ -411,8 +411,8 @@
array([], dtype=float64)
>>> to_writeable(None)
- >>> to_writeable('a string').dtype
- dtype('|S8')
+ >>> to_writeable('a string').dtype.type == np.str_
+ True
>>> to_writeable(1)
array(1)
>>> to_writeable([1])
Modified: trunk/scipy/io/matlab/tests/test_mio.py
===================================================================
--- trunk/scipy/io/matlab/tests/test_mio.py 2010-11-12 00:57:02 UTC (rev 6869)
+++ trunk/scipy/io/matlab/tests/test_mio.py 2010-11-12 00:57:18 UTC (rev 6870)
@@ -821,6 +821,7 @@
for dts in ('f8','f4','i8','i4','i2','i1',
'u8','u4','u2','u1','c16','c8'):
stream.truncate(0)
+ stream.seek(0) # needed for BytesIO in python 3
savemat_future(stream, {'arr': arr.astype(dts)})
vars = loadmat(stream)
assert_equal(np.dtype(dts), vars['arr'].dtype)
Modified: trunk/scipy/io/matlab/tests/test_mio5_utils.py
===================================================================
--- trunk/scipy/io/matlab/tests/test_mio5_utils.py 2010-11-12 00:57:02 UTC (rev 6869)
+++ trunk/scipy/io/matlab/tests/test_mio5_utils.py 2010-11-12 00:57:18 UTC (rev 6870)
@@ -12,6 +12,8 @@
import numpy as np
+from numpy.compat import asbytes
+
from nose.tools import assert_true, assert_false, \
assert_equal, assert_raises
@@ -171,7 +173,7 @@
hdr = m5u.VarHeader5()
# Try when string is 1 length
hdr.set_dims([1,])
- _write_stream(str_io, tag.tostring() + ' ')
+ _write_stream(str_io, tag.tostring() + asbytes(' '))
str_io.seek(0)
val = c_reader.read_char(hdr)
assert_equal(val, u' ')
More information about the Scipy-svn
mailing list