[Scipy-svn] r3782 - in branches/testing_cleanup/scipy: io io/matlab io/matlab/tests io/matlab/tests/data io/tests misc/tests optimize/tests sparse/tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Fri Jan 4 16:28:50 EST 2008
Author: matthew.brett at gmail.com
Date: 2008-01-04 15:27:41 -0600 (Fri, 04 Jan 2008)
New Revision: 3782
Added:
branches/testing_cleanup/scipy/io/matlab/tests/
branches/testing_cleanup/scipy/io/matlab/tests/data/
branches/testing_cleanup/scipy/io/matlab/tests/data/japanese_utf8.txt
branches/testing_cleanup/scipy/io/matlab/tests/data/test3dmatrix_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/test3dmatrix_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/test3dmatrix_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcell_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcell_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcell_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcellnest_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcellnest_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcellnest_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcomplex_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcomplex_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcomplex_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcomplex_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testdouble_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testdouble_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testdouble_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testdouble_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testemptycell_5.3_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testemptycell_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testemptycell_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testmatrix_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testmatrix_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testmatrix_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testmatrix_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testminus_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testminus_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testminus_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testminus_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testmulti_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testmulti_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testobject_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testobject_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testobject_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testonechar_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testonechar_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testonechar_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testonechar_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testsparse_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testsparse_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testsparse_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testsparse_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testsparsecomplex_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testsparsecomplex_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testsparsecomplex_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testsparsecomplex_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststring_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststring_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststring_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststring_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststringarray_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststringarray_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststringarray_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststringarray_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststruct_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststruct_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststruct_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststructarr_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststructarr_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststructarr_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststructnest_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststructnest_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststructnest_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testunicode_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testvec_4_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/test_mio.py
branches/testing_cleanup/scipy/misc/tests/test_basic.py
Removed:
branches/testing_cleanup/scipy/io/matlab/tests/data/
branches/testing_cleanup/scipy/io/matlab/tests/data/japanese_utf8.txt
branches/testing_cleanup/scipy/io/matlab/tests/data/test3dmatrix_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/test3dmatrix_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/test3dmatrix_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcell_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcell_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcell_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcellnest_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcellnest_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcellnest_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcomplex_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcomplex_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcomplex_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testcomplex_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testdouble_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testdouble_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testdouble_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testdouble_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testemptycell_5.3_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testemptycell_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testemptycell_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testmatrix_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testmatrix_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testmatrix_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testmatrix_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testminus_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testminus_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testminus_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testminus_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testmulti_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testmulti_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testobject_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testobject_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testobject_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testonechar_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testonechar_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testonechar_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testonechar_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testsparse_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testsparse_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testsparse_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testsparse_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testsparsecomplex_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testsparsecomplex_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testsparsecomplex_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testsparsecomplex_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststring_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststring_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststring_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststring_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststringarray_4.2c_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststringarray_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststringarray_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststringarray_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststruct_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststruct_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststruct_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststructarr_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststructarr_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststructarr_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststructnest_6.1_SOL2.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststructnest_6.5.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/teststructnest_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testunicode_7.1_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/data/testvec_4_GLNX86.mat
branches/testing_cleanup/scipy/io/matlab/tests/test_mio.py
branches/testing_cleanup/scipy/io/tests/data/
branches/testing_cleanup/scipy/io/tests/test_mio.py
Modified:
branches/testing_cleanup/scipy/io/__init__.py
branches/testing_cleanup/scipy/io/matlab/mio5.py
branches/testing_cleanup/scipy/io/matlab/setup.py
branches/testing_cleanup/scipy/optimize/tests/test_slsqp.py
branches/testing_cleanup/scipy/sparse/tests/test_base.py
Log:
matlab io refixed
Modified: branches/testing_cleanup/scipy/io/__init__.py
===================================================================
--- branches/testing_cleanup/scipy/io/__init__.py 2008-01-04 12:29:00 UTC (rev 3781)
+++ branches/testing_cleanup/scipy/io/__init__.py 2008-01-04 21:27:41 UTC (rev 3782)
@@ -83,8 +83,6 @@
from data_store import save_as_module
from mmio import mminfo, mmread, mmwrite
-
-
__all__ = filter(lambda s:not s.startswith('_'),dir())
-from numpy.testing import NumpyTest
-test = NumpyTest().test
+from scipy.testing.moduletest import test_func
+test = test_func
Modified: branches/testing_cleanup/scipy/io/matlab/mio5.py
===================================================================
--- branches/testing_cleanup/scipy/io/matlab/mio5.py 2008-01-04 12:29:00 UTC (rev 3781)
+++ branches/testing_cleanup/scipy/io/matlab/mio5.py 2008-01-04 21:27:41 UTC (rev 3782)
@@ -603,10 +603,14 @@
af['nzmax'] = nzmax
self.write_dtype(af)
# write array shape
- self.arr=N.atleast_2d(self.arr)
+ if self.arr.ndim < 2:
+ new_arr = N.atleast_2d(self.arr)
+ if type(new_arr) != type(self.arr):
+ raise ValueError("Array should be 2-dimensional.")
+ self.arr = new_arr
self.write_element(N.array(self.arr.shape, dtype='i4'))
# write name
- self.write_element(N.ndarray(shape=len(self.name), dtype='S1', buffer=self.name))
+ self.write_element(N.array([ord(c) for c in self.name], 'i1'))
def update_matrix_tag(self):
curr_pos = self.file_stream.tell()
@@ -663,26 +667,24 @@
def write(self):
''' Sparse matrices are 2D
- See docstring for Mat5SparseGetter
+
'''
- imagf = self.arr.dtype.kind == 'c'
- N = self.arr.nnz
- ijd = N.zeros((N+1, 3+imagf), dtype='f8')
- for i in range(N):
- ijd[i,0], ijd[i,1] = self.arr.rowcol(i)
- ijd[:-1,0:2] += 1 # 1 based indexing
- if imagf:
- ijd[:-1,2] = self.arr.data.real
- ijd[:-1,3] = self.arr.data.imag
- else:
- ijd[:-1,2] = self.arr.data
- ijd[-1,0:2] = self.arr.shape
- self.write_header(P=miDOUBLE,
- T=mxSPARSE_CLASS,
- dims=ijd.shape)
- self.write_bytes(ijd)
+ A = self.arr.tocsc() # convert to sparse CSC format
+ A.sort_indices() # MATLAB expects sorted row indices
+ is_complex = (A.dtype.kind == 'c')
+ nz = A.nnz
+ self.write_header(mclass=mxSPARSE_CLASS,
+ is_complex=is_complex,
+ nzmax=nz)
+ self.write_element(A.indices.astype('i4'))
+ self.write_element(A.indptr.astype('i4'))
+ self.write_element(A.data.real)
+ if is_complex:
+ self.write_element(A.data.imag)
+ self.update_matrix_tag()
+
class Mat5WriterGetter(object):
''' Wraps stream and options, provides methods for getting Writer objects '''
def __init__(self, stream, unicode_strings):
Modified: branches/testing_cleanup/scipy/io/matlab/setup.py
===================================================================
--- branches/testing_cleanup/scipy/io/matlab/setup.py 2008-01-04 12:29:00 UTC (rev 3781)
+++ branches/testing_cleanup/scipy/io/matlab/setup.py 2008-01-04 21:27:41 UTC (rev 3782)
@@ -3,6 +3,7 @@
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('matlab', parent_package, top_path)
+ config.add_data_dir('tests')
return config
if __name__ == '__main__':
Copied: branches/testing_cleanup/scipy/io/matlab/tests (from rev 3778, trunk/scipy/io/matlab/tests)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data (from rev 3778, trunk/scipy/io/matlab/tests/data)
Property changes on: branches/testing_cleanup/scipy/io/matlab/tests/data
___________________________________________________________________
Name: svn:ignore
+ *.pyc
*.swp
*.pyd
*.so
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/japanese_utf8.txt
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/japanese_utf8.txt (from rev 3778, trunk/scipy/io/matlab/tests/data/japanese_utf8.txt)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/test3dmatrix_6.1_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/test3dmatrix_6.1_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/test3dmatrix_6.1_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/test3dmatrix_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/test3dmatrix_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/test3dmatrix_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/test3dmatrix_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/test3dmatrix_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/test3dmatrix_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testcell_6.1_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testcell_6.1_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testcell_6.1_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testcell_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testcell_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testcell_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testcell_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testcell_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testcell_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testcellnest_6.1_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testcellnest_6.1_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testcellnest_6.1_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testcellnest_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testcellnest_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testcellnest_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testcellnest_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testcellnest_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testcellnest_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testcomplex_4.2c_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testcomplex_4.2c_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testcomplex_4.2c_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testcomplex_6.1_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testcomplex_6.1_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testcomplex_6.1_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testcomplex_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testcomplex_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testcomplex_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testcomplex_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testcomplex_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testcomplex_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testdouble_4.2c_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testdouble_4.2c_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testdouble_4.2c_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testdouble_6.1_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testdouble_6.1_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testdouble_6.1_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testdouble_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testdouble_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testdouble_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testdouble_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testdouble_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testdouble_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testemptycell_5.3_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testemptycell_5.3_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testemptycell_5.3_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testemptycell_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testemptycell_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testemptycell_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testemptycell_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testemptycell_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testemptycell_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testmatrix_4.2c_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testmatrix_4.2c_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testmatrix_4.2c_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testmatrix_6.1_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testmatrix_6.1_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testmatrix_6.1_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testmatrix_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testmatrix_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testmatrix_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testmatrix_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testmatrix_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testmatrix_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testminus_4.2c_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testminus_4.2c_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testminus_4.2c_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testminus_6.1_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testminus_6.1_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testminus_6.1_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testminus_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testminus_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testminus_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testminus_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testminus_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testminus_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testmulti_4.2c_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testmulti_4.2c_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testmulti_4.2c_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testmulti_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testmulti_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testmulti_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testobject_6.1_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testobject_6.1_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testobject_6.1_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testobject_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testobject_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testobject_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testobject_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testobject_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testobject_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testonechar_4.2c_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testonechar_4.2c_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testonechar_4.2c_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testonechar_6.1_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testonechar_6.1_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testonechar_6.1_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testonechar_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testonechar_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testonechar_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testonechar_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testonechar_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testonechar_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testsparse_4.2c_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testsparse_4.2c_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testsparse_4.2c_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testsparse_6.1_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testsparse_6.1_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testsparse_6.1_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testsparse_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testsparse_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testsparse_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testsparse_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testsparse_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testsparse_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testsparsecomplex_4.2c_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testsparsecomplex_4.2c_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testsparsecomplex_4.2c_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testsparsecomplex_6.1_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testsparsecomplex_6.1_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testsparsecomplex_6.1_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testsparsecomplex_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testsparsecomplex_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testsparsecomplex_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testsparsecomplex_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testsparsecomplex_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testsparsecomplex_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststring_4.2c_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststring_4.2c_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststring_4.2c_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststring_6.1_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststring_6.1_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststring_6.1_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststring_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststring_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststring_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststring_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststring_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststring_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststringarray_4.2c_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststringarray_4.2c_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststringarray_4.2c_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststringarray_6.1_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststringarray_6.1_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststringarray_6.1_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststringarray_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststringarray_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststringarray_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststringarray_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststringarray_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststringarray_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststruct_6.1_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststruct_6.1_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststruct_6.1_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststruct_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststruct_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststruct_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststruct_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststruct_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststruct_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststructarr_6.1_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststructarr_6.1_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststructarr_6.1_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststructarr_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststructarr_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststructarr_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststructarr_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststructarr_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststructarr_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststructnest_6.1_SOL2.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststructnest_6.1_SOL2.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststructnest_6.1_SOL2.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststructnest_6.5.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststructnest_6.5.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststructnest_6.5.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/teststructnest_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/teststructnest_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/teststructnest_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testunicode_7.1_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testunicode_7.1_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testunicode_7.1_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/data/testvec_4_GLNX86.mat
===================================================================
(Binary files differ)
Copied: branches/testing_cleanup/scipy/io/matlab/tests/data/testvec_4_GLNX86.mat (from rev 3778, trunk/scipy/io/matlab/tests/data/testvec_4_GLNX86.mat)
Deleted: branches/testing_cleanup/scipy/io/matlab/tests/test_mio.py
===================================================================
--- trunk/scipy/io/matlab/tests/test_mio.py 2008-01-04 01:29:56 UTC (rev 3778)
+++ branches/testing_cleanup/scipy/io/matlab/tests/test_mio.py 2008-01-04 21:27:41 UTC (rev 3782)
@@ -1,248 +0,0 @@
-#!/usr/bin/env python
-
-import os
-from glob import glob
-from cStringIO import StringIO
-from tempfile import mkstemp
-from numpy.testing import set_package_path, restore_path, NumpyTestCase, NumpyTest
-from numpy.testing import assert_equal, assert_array_almost_equal
-from numpy import arange, array, eye, pi, cos, exp, sin, sqrt, ndarray, \
- zeros, reshape, transpose, empty
-import scipy.sparse as SP
-
-set_package_path()
-from matlab.mio import loadmat, savemat
-from matlab.mio5 import mat_obj, mat_struct
-restore_path()
-
-try: # Python 2.3 support
- from sets import Set as set
-except:
- pass
-
-test_data_path = os.path.join(os.path.dirname(__file__), './data')
-
-class TestMIOArray(NumpyTestCase):
- def __init__(self, *args, **kwargs):
- super(TestMIOArray, self).__init__(*args, **kwargs)
-
- def _check_level(self, label, expected, actual):
- """ Check one level of a potentially nested object / list """
- # object array is returned from cell array in mat file
- typex = type(expected)
- typac = type(actual)
- if isinstance(expected, ndarray) and expected.dtype.hasobject:
- assert typex is typac, "Different types at %s" % label
- assert len(expected) == len(actual), "Different list lengths at %s" % label
- for i, ev in enumerate(expected):
- level_label = "%s, [%d], " % (label, i)
- self._check_level(level_label, ev, actual[i])
- return
- # object, as container for matlab structs and objects
- elif isinstance(expected, mat_struct) or isinstance(expected, mat_obj):
- assert isinstance(actual, typex), \
- "Different types %s and %s at %s" % (typex, typac, label)
- ex_fields = dir(expected)
- ac_fields = dir(actual)
- for k in ex_fields:
- if k.startswith('__') and k.endswith('__'):
- continue
- assert k in ac_fields, "Missing property at %s" % label
- ev = expected.__dict__[k]
- v = actual.__dict__[k]
- level_label = "%s, property %s, " % (label, k)
- self._check_level(level_label, ev, v)
- return
- # hoping this is a single value, which might be an array
- if SP.issparse(expected):
- assert SP.issparse(actual), "Expected sparse at %s" % label
- assert_array_almost_equal(actual.todense(),
- expected.todense(),
- err_msg = label,
- decimal = 5)
- elif isinstance(expected, ndarray):
- if expected.shape: # allow scalar and 0d array comparisons
- assert isinstance(actual, ndarray), "Expected ndarray at %s" % label
- assert_array_almost_equal(actual, expected, err_msg=label, decimal=5)
- else:
- assert isinstance(expected, typac), \
- "Types %s and %s do not match at %s" % (typex, typac, label)
- assert_equal(actual, expected, err_msg=label)
-
- def _check_case(self, name, files, case):
- for file_name in files:
- matdict = loadmat(file_name)
- label = "test %s; file %s" % (name, file_name)
- for k, expected in case.items():
- k_label = "%s, variable %s" % (label, k)
- assert k in matdict, "Missing key at %s" % k_label
- self._check_level(k_label, expected, matdict[k])
-
- # Add the load tests dynamically, with given parameters
- def _make_check_case(name, files, expected):
- def cc(self):
- self._check_case(name, files, expected)
- cc.__doc__ = "check loadmat case %s" % name
- return cc
-
- # Add the round trip tests dynamically, with given parameters
- def _make_rt_check_case(name, expected, format):
- def cc(self):
- mat_stream = StringIO()
- savemat(mat_stream, expected, format=format)
- mat_stream.seek(0)
- self._check_case(name, [mat_stream], expected)
- cc.__doc__ = "check loadmat case %s" % name
- return cc
-
- # Define cases to test
- theta = pi/4*arange(9,dtype=float)
- case_table4 = [
- {'name': 'double',
- 'expected': {'testdouble': theta}
- }]
- case_table4.append(
- {'name': 'string',
- 'expected': {'teststring': u'"Do nine men interpret?" "Nine men," I nod.'},
- })
- case_table4.append(
- {'name': 'complex',
- 'expected': {'testcomplex': cos(theta) + 1j*sin(theta)}
- })
- A = zeros((3,5))
- A[0] = range(1,6)
- A[:,0] = range(1,4)
- case_table4.append(
- {'name': 'matrix',
- 'expected': {'testmatrix': A},
- })
- case_table4.append(
- {'name': 'sparse',
- 'expected': {'testsparse': SP.csc_matrix(A)},
- })
- B = A.astype(complex)
- B[0,0] += 1j
- case_table4.append(
- {'name': 'sparsecomplex',
- 'expected': {'testsparsecomplex': SP.csc_matrix(B)},
- })
- case_table4.append(
- {'name': 'multi',
- 'expected': {'theta': theta,
- 'a': A},
- })
- case_table4.append(
- {'name': 'minus',
- 'expected': {'testminus': array(-1)},
- })
- case_table4.append(
- {'name': 'onechar',
- 'expected': {'testonechar': u'r'},
- })
- case_table5 = [
- {'name': 'cell',
- 'expected': {'testcell':
- array([u'This cell contains this string and 3 arrays of '+\
- 'increasing length',
- array(1), array([1,2]), array([1,2,3])],
- dtype=object)}
- }]
- case_table5.append(
- {'name': 'emptycell',
- 'expected': {'testemptycell':
- array([array(1), array(2), array([]),
- array([]), array(3)], dtype=object)}
- })
- case_table5.append(
- {'name': 'stringarray',
- 'expected': {'teststringarray': array(
- [u'one ', u'two ', u'three'], dtype=object)},
- })
- case_table5.append(
- {'name': '3dmatrix',
- 'expected': {'test3dmatrix': transpose(reshape(range(1,25), (4,3,2)))}
- })
- case_table5_rt = [
- {'name': '3dmatrix',
- 'expected': {'test3dmatrix': transpose(reshape(range(1,25), (4,3,2)))}
- },
- {'name': 'sparsefloat',
- 'expected': {'testsparsefloat': SP.csc_matrix(array([[1,0,2],[0,-3.5,0]]))},
- },
- {'name': 'sparsecomplex',
- 'expected': {'testsparsefloat': SP.csc_matrix(array([[-1+2j,0,2],[0,-3j,0]]))},
- },
- ]
- st = mat_struct()
- st.stringfield = u'Rats live on no evil star.'
- st.doublefield = array([sqrt(2),exp(1),pi])
- st.complexfield = (1+1j)*array([sqrt(2),exp(1),pi])
- case_table5.append(
- {'name': 'struct',
- 'expected': {'teststruct': st}
- })
- a = array([array(1),
- array([array(2), array(3),
- array([array(4), array(5)],
- dtype=object)],
- dtype=object)],
- dtype=object)
- case_table5.append(
- {'name': 'cellnest',
- 'expected': {'testcellnest': a},
- })
- st = mat_struct()
- st.one = array(1)
- st.two = mat_struct()
- st.two.three = u'number 3'
- case_table5.append(
- {'name': 'structnest',
- 'expected': {'teststructnest': st}
- })
- a = array([mat_struct(), mat_struct()])
- a[0].one = array(1)
- a[0].two = array(2)
- a[1].one = u'number 1'
- a[1].two = u'number 2'
- case_table5.append(
- {'name': 'structarr',
- 'expected': {'teststructarr': a}
- })
- a = mat_obj()
- a._classname = 'inline'
- a.expr = u'x'
- a.inputExpr = u' x = INLINE_INPUTS_{1};'
- a.args = u'x'
- a.isEmpty = array(0)
- a.numArgs = array(1)
- a.version = array(1)
- case_table5.append(
- {'name': 'object',
- 'expected': {'testobject': a}
- })
- u_str = file(
- os.path.join(test_data_path, 'japanese_utf8.txt'),
- 'rb').read().decode('utf-8')
- case_table5.append(
- {'name': 'unicode',
- 'expected': {'testunicode': u_str}
- })
- # add load tests
- for case in case_table4 + case_table5:
- name = case['name']
- expected = case['expected']
- filt = os.path.join(test_data_path, 'test%s_*.mat' % name)
- files = glob(filt)
- assert files, "No files for test %s using filter %s" % (name, filt)
- exec 'check_%s = _make_check_case(name, files, expected)' % name
- # round trip tests
- for case in case_table4 + case_table5_rt:
- name = case['name'] + '_round_trip'
- expected = case['expected']
- format = case in case_table4 and '4' or '5'
- exec 'check_%s = _make_rt_check_case(name, expected, format)' \
- % name
-
-
-if __name__ == "__main__":
- NumpyTest().run()
Copied: branches/testing_cleanup/scipy/io/matlab/tests/test_mio.py (from rev 3778, trunk/scipy/io/matlab/tests/test_mio.py)
===================================================================
--- trunk/scipy/io/matlab/tests/test_mio.py 2008-01-04 01:29:56 UTC (rev 3778)
+++ branches/testing_cleanup/scipy/io/matlab/tests/test_mio.py 2008-01-04 21:27:41 UTC (rev 3782)
@@ -0,0 +1,242 @@
+#!/usr/bin/env python
+''' Nose test generators '''
+import os
+from glob import glob
+from cStringIO import StringIO
+from tempfile import mkstemp
+from scipy.testing import *
+from numpy import arange, array, eye, pi, cos, exp, sin, sqrt, ndarray, \
+ zeros, reshape, transpose, empty
+import scipy.sparse as SP
+
+from scipy.io.matlab.mio import loadmat, savemat
+from scipy.io.matlab.mio5 import mat_obj, mat_struct
+
+try: # Python 2.3 support
+ from sets import Set as set
+except:
+ pass
+
+test_data_path = os.path.join(os.path.dirname(__file__), 'data')
+
+def _check_level(self, label, expected, actual):
+ """ Check one level of a potentially nested object / list """
+ # object array is returned from cell array in mat file
+ typex = type(expected)
+ typac = type(actual)
+ if isinstance(expected, ndarray) and expected.dtype.hasobject:
+ assert typex is typac, "Different types at %s" % label
+ assert len(expected) == len(actual), "Different list lengths at %s" % label
+ for i, ev in enumerate(expected):
+ level_label = "%s, [%d], " % (label, i)
+ self._check_level(level_label, ev, actual[i])
+ return
+ # object, as container for matlab structs and objects
+ elif isinstance(expected, mat_struct) or isinstance(expected, mat_obj):
+ assert isinstance(actual, typex), \
+ "Different types %s and %s at %s" % (typex, typac, label)
+ ex_fields = dir(expected)
+ ac_fields = dir(actual)
+ for k in ex_fields:
+ if k.startswith('__') and k.endswith('__'):
+ continue
+ assert k in ac_fields, "Missing property at %s" % label
+ ev = expected.__dict__[k]
+ v = actual.__dict__[k]
+ level_label = "%s, property %s, " % (label, k)
+ self._check_level(level_label, ev, v)
+ return
+ # hoping this is a single value, which might be an array
+ if SP.issparse(expected):
+ assert SP.issparse(actual), "Expected sparse at %s" % label
+ assert_array_almost_equal(actual.todense(),
+ expected.todense(),
+ err_msg = label,
+ decimal = 5)
+ elif isinstance(expected, ndarray):
+ if expected.shape: # allow scalar and 0d array comparisons
+ assert isinstance(actual, ndarray), "Expected ndarray at %s" % label
+ assert_array_almost_equal(actual, expected, err_msg=label, decimal=5)
+ else:
+ assert isinstance(expected, typac), \
+ "Types %s and %s do not match at %s" % (typex, typac, label)
+ assert_equal(actual, expected, err_msg=label)
+
+def _check_case(self, name, files, case):
+ for file_name in files:
+ matdict = loadmat(file_name)
+ label = "test %s; file %s" % (name, file_name)
+ for k, expected in case.items():
+ k_label = "%s, variable %s" % (label, k)
+ assert k in matdict, "Missing key at %s" % k_label
+ self._check_level(k_label, expected, matdict[k])
+
+# Add the load tests dynamically, with given parameters
+def _make_check_case(name, files, expected):
+ def cc(self):
+ self._check_case(name, files, expected)
+ cc.__doc__ = "check loadmat case %s" % name
+ return cc
+
+# Add the round trip tests dynamically, with given parameters
+def _make_rt_check_case(name, expected, format):
+ def cc(self):
+ mat_stream = StringIO()
+ savemat(mat_stream, expected, format=format)
+ mat_stream.seek(0)
+ self._check_case(name, [mat_stream], expected)
+ cc.__doc__ = "check loadmat case %s" % name
+ return cc
+
+# Define cases to test
+theta = pi/4*arange(9,dtype=float)
+case_table4 = [
+ {'name': 'double',
+ 'expected': {'testdouble': theta}
+ }]
+case_table4.append(
+ {'name': 'string',
+ 'expected': {'teststring': u'"Do nine men interpret?" "Nine men," I nod.'},
+ })
+case_table4.append(
+ {'name': 'complex',
+ 'expected': {'testcomplex': cos(theta) + 1j*sin(theta)}
+ })
+A = zeros((3,5))
+A[0] = range(1,6)
+A[:,0] = range(1,4)
+case_table4.append(
+ {'name': 'matrix',
+ 'expected': {'testmatrix': A},
+ })
+case_table4.append(
+ {'name': 'sparse',
+ 'expected': {'testsparse': SP.csc_matrix(A)},
+ })
+B = A.astype(complex)
+B[0,0] += 1j
+case_table4.append(
+ {'name': 'sparsecomplex',
+ 'expected': {'testsparsecomplex': SP.csc_matrix(B)},
+ })
+case_table4.append(
+ {'name': 'multi',
+ 'expected': {'theta': theta,
+ 'a': A},
+ })
+case_table4.append(
+ {'name': 'minus',
+ 'expected': {'testminus': array(-1)},
+ })
+case_table4.append(
+ {'name': 'onechar',
+ 'expected': {'testonechar': u'r'},
+ })
+case_table5 = [
+ {'name': 'cell',
+ 'expected': {'testcell':
+ array([u'This cell contains this string and 3 arrays of '+\
+ 'increasing length',
+ array(1), array([1,2]), array([1,2,3])],
+ dtype=object)}
+ }]
+case_table5.append(
+ {'name': 'emptycell',
+ 'expected': {'testemptycell':
+ array([array(1), array(2), array([]),
+ array([]), array(3)], dtype=object)}
+ })
+case_table5.append(
+ {'name': 'stringarray',
+ 'expected': {'teststringarray': array(
+ [u'one ', u'two ', u'three'], dtype=object)},
+ })
+case_table5.append(
+ {'name': '3dmatrix',
+ 'expected': {'test3dmatrix': transpose(reshape(range(1,25), (4,3,2)))}
+ })
+case_table5_rt = [
+ {'name': '3dmatrix',
+ 'expected': {'test3dmatrix': transpose(reshape(range(1,25), (4,3,2)))}
+ },
+ {'name': 'sparsefloat',
+ 'expected': {'testsparsefloat': SP.csc_matrix(array([[1,0,2],[0,-3.5,0]]))},
+ },
+ {'name': 'sparsecomplex',
+ 'expected': {'testsparsefloat': SP.csc_matrix(array([[-1+2j,0,2],[0,-3j,0]]))},
+ },
+ ]
+st = mat_struct()
+st.stringfield = u'Rats live on no evil star.'
+st.doublefield = array([sqrt(2),exp(1),pi])
+st.complexfield = (1+1j)*array([sqrt(2),exp(1),pi])
+case_table5.append(
+ {'name': 'struct',
+ 'expected': {'teststruct': st}
+ })
+a = array([array(1),
+ array([array(2), array(3),
+ array([array(4), array(5)],
+ dtype=object)],
+ dtype=object)],
+ dtype=object)
+case_table5.append(
+ {'name': 'cellnest',
+ 'expected': {'testcellnest': a},
+ })
+st = mat_struct()
+st.one = array(1)
+st.two = mat_struct()
+st.two.three = u'number 3'
+case_table5.append(
+ {'name': 'structnest',
+ 'expected': {'teststructnest': st}
+ })
+a = array([mat_struct(), mat_struct()])
+a[0].one = array(1)
+a[0].two = array(2)
+a[1].one = u'number 1'
+a[1].two = u'number 2'
+case_table5.append(
+ {'name': 'structarr',
+ 'expected': {'teststructarr': a}
+ })
+a = mat_obj()
+a._classname = 'inline'
+a.expr = u'x'
+a.inputExpr = u' x = INLINE_INPUTS_{1};'
+a.args = u'x'
+a.isEmpty = array(0)
+a.numArgs = array(1)
+a.version = array(1)
+case_table5.append(
+ {'name': 'object',
+ 'expected': {'testobject': a}
+ })
+u_str = file(
+ os.path.join(test_data_path, 'japanese_utf8.txt'),
+ 'rb').read().decode('utf-8')
+case_table5.append(
+ {'name': 'unicode',
+ 'expected': {'testunicode': u_str}
+ })
+
+# generator for load tests
+def test_load():
+ for case in case_table4 + case_table5:
+ name = case['name']
+ expected = case['expected']
+ filt = os.path.join(test_data_path, 'test%s_*.mat' % name)
+ files = glob(filt)
+ assert files, "No files for test %s using filter %s" % (name, filt)
+ yield _make_check_case, name, files, expected
+
+# round trip tests
+def test_round_trip():
+ for case in case_table4 + case_table5_rt:
+ name = case['name'] + '_round_trip'
+ expected = case['expected']
+ format = case in case_table4 and '4' or '5'
+ yield _make_rt_check_case, name, expected, format
+
+
Deleted: branches/testing_cleanup/scipy/io/tests/test_mio.py
===================================================================
--- branches/testing_cleanup/scipy/io/tests/test_mio.py 2008-01-04 12:29:00 UTC (rev 3781)
+++ branches/testing_cleanup/scipy/io/tests/test_mio.py 2008-01-04 21:27:41 UTC (rev 3782)
@@ -1,234 +0,0 @@
-#!/usr/bin/env python
-
-import os
-from glob import glob
-from cStringIO import StringIO
-from tempfile import mkstemp
-from numpy import arange, array, eye, pi, cos, exp, sin, sqrt, ndarray, \
- zeros, reshape, transpose, empty
-import scipy.sparse as SP
-
-from scipy.testing import *
-
-from matlab.mio import loadmat, savemat
-from matlab.mio5 import mat_obj, mat_struct
-
-try: # Python 2.3 support
- from sets import Set as set
-except:
- pass
-
-test_data_path = os.path.join(os.path.dirname(__file__), './data')
-
-def _check_level(self, label, expected, actual):
- """ Check one level of a potentially nested object / list """
- # object array is returned from cell array in mat file
- typex = type(expected)
- typac = type(actual)
- if isinstance(expected, ndarray) and expected.dtype.hasobject:
- assert typex is typac, "Different types at %s" % label
- assert len(expected) == len(actual), "Different list lengths at %s" % label
- for i, ev in enumerate(expected):
- level_label = "%s, [%d], " % (label, i)
- self._check_level(level_label, ev, actual[i])
- return
- # object, as container for matlab structs and objects
- elif isinstance(expected, mat_struct) or isinstance(expected, mat_obj):
- assert isinstance(actual, typex), \
- "Different types %s and %s at %s" % (typex, typac, label)
- ex_fields = dir(expected)
- ac_fields = dir(actual)
- for k in ex_fields:
- if k.startswith('__') and k.endswith('__'):
- continue
- assert k in ac_fields, "Missing property at %s" % label
- ev = expected.__dict__[k]
- v = actual.__dict__[k]
- level_label = "%s, property %s, " % (label, k)
- self._check_level(level_label, ev, v)
- return
- # hoping this is a single value, which might be an array
- if SP.issparse(expected):
- assert SP.issparse(actual), "Expected sparse at %s" % label
- assert_array_almost_equal(actual.todense(),
- expected.todense(),
- err_msg = label,
- decimal = 5)
- elif isinstance(expected, ndarray):
- if expected.shape: # allow scalar and 0d array comparisons
- assert isinstance(actual, ndarray), "Expected ndarray at %s" % label
- assert_array_almost_equal(actual, expected, err_msg=label, decimal=5)
- else:
- assert isinstance(expected, typac), \
- "Types %s and %s do not match at %s" % (typex, typac, label)
- assert_equal(actual, expected, err_msg=label)
-
-def _check_case(self, name, files, case):
- for file_name in files:
- matdict = loadmat(file_name)
- label = "test %s; file %s" % (name, file_name)
- for k, expected in case.items():
- k_label = "%s, variable %s" % (label, k)
- assert k in matdict, "Missing key at %s" % k_label
- self._check_level(k_label, expected, matdict[k])
-
-# Add the load tests dynamically, with given parameters
-def _make_check_case(name, files, expected):
- def cc(self):
- self._check_case(name, files, expected)
- cc.__doc__ = "check loadmat case %s" % name
- return cc
-
-# Add the round trip tests dynamically, with given parameters
-def _make_rt_check_case(name, expected, format):
- def cc(self):
- mat_stream = StringIO()
- savemat(mat_stream, expected, format=format)
- mat_stream.seek(0)
- self._check_case(name, [mat_stream], expected)
- cc.__doc__ = "check loadmat case %s" % name
- return cc
-
-# Define cases to test
-theta = pi/4*arange(9,dtype=float)
-case_table4 = [
- {'name': 'double',
- 'expected': {'testdouble': theta}
- }]
-case_table4.append(
- {'name': 'string',
- 'expected': {'teststring': u'"Do nine men interpret?" "Nine men," I nod.'},
- })
-case_table4.append(
- {'name': 'complex',
- 'expected': {'testcomplex': cos(theta) + 1j*sin(theta)}
- })
-A = zeros((3,5))
-A[0] = range(1,6)
-A[:,0] = range(1,4)
-case_table4.append(
- {'name': 'matrix',
- 'expected': {'testmatrix': A},
- })
-case_table4.append(
- {'name': 'sparse',
- 'expected': {'testsparse': SP.csc_matrix(A)},
- })
-B = A.astype(complex)
-B[0,0] += 1j
-case_table4.append(
- {'name': 'sparsecomplex',
- 'expected': {'testsparsecomplex': SP.csc_matrix(B)},
- })
-case_table4.append(
- {'name': 'multi',
- 'expected': {'theta': theta,
- 'a': A},
- })
-case_table4.append(
- {'name': 'minus',
- 'expected': {'testminus': array(-1)},
- })
-case_table4.append(
- {'name': 'onechar',
- 'expected': {'testonechar': u'r'},
- })
-case_table5 = [
- {'name': 'cell',
- 'expected': {'testcell':
- array([u'This cell contains this string and 3 arrays of '+\
- 'increasing length',
- array(1), array([1,2]), array([1,2,3])],
- dtype=object)}
- }]
-case_table5.append(
- {'name': 'emptycell',
- 'expected': {'testemptycell':
- array([array(1), array(2), array([]),
- array([]), array(3)], dtype=object)}
- })
-case_table5.append(
- {'name': 'stringarray',
- 'expected': {'teststringarray': array(
- [u'one ', u'two ', u'three'], dtype=object)},
- })
-case_table5.append(
- {'name': '3dmatrix',
- 'expected': {'test3dmatrix': transpose(reshape(range(1,25), (4,3,2)))}
- })
-case_table5_rt = [
- {'name': '3dmatrix',
- 'expected': {'test3dmatrix': transpose(reshape(range(1,25), (4,3,2)))}
- }]
-st = mat_struct()
-st.stringfield = u'Rats live on no evil star.'
-st.doublefield = array([sqrt(2),exp(1),pi])
-st.complexfield = (1+1j)*array([sqrt(2),exp(1),pi])
-case_table5.append(
- {'name': 'struct',
- 'expected': {'teststruct': st}
- })
-a = array([array(1),
- array([array(2), array(3),
- array([array(4), array(5)],
- dtype=object)],
- dtype=object)],
- dtype=object)
-case_table5.append(
- {'name': 'cellnest',
- 'expected': {'testcellnest': a},
- })
-st = mat_struct()
-st.one = array(1)
-st.two = mat_struct()
-st.two.three = u'number 3'
-case_table5.append(
- {'name': 'structnest',
- 'expected': {'teststructnest': st}
- })
-a = array([mat_struct(), mat_struct()])
-a[0].one = array(1)
-a[0].two = array(2)
-a[1].one = u'number 1'
-a[1].two = u'number 2'
-case_table5.append(
- {'name': 'structarr',
- 'expected': {'teststructarr': a}
- })
-a = mat_obj()
-a._classname = 'inline'
-a.expr = u'x'
-a.inputExpr = u' x = INLINE_INPUTS_{1};'
-a.args = u'x'
-a.isEmpty = array(0)
-a.numArgs = array(1)
-a.version = array(1)
-case_table5.append(
- {'name': 'object',
- 'expected': {'testobject': a}
- })
-u_str = file(
- os.path.join(test_data_path, 'japanese_utf8.txt'),
- 'rb').read().decode('utf-8')
-case_table5.append(
- {'name': 'unicode',
- 'expected': {'testunicode': u_str}
- })
-# add load tests
-
-def test_loads():
- for case in case_table4 + case_table5:
- name = case['name']
- expected = case['expected']
- filt = os.path.join(test_data_path, 'test%s_*.mat' % name)
- files = glob(filt)
- assert files, "No files for test %s using filter %s" % (name, filt)
- yield _make_check_case, name, files, expected
-
-def test_round_trips():
- for case in case_table4 + case_table5_rt:
- name = case['name'] + '_round_trip'
- expected = case['expected']
- format = case in case_table4 and '4' or '5'
- yield _make_rt_check_case, name, expected, format
-
Added: branches/testing_cleanup/scipy/misc/tests/test_basic.py
===================================================================
--- branches/testing_cleanup/scipy/misc/tests/test_basic.py 2008-01-04 12:29:00 UTC (rev 3781)
+++ branches/testing_cleanup/scipy/misc/tests/test_basic.py 2008-01-04 21:27:41 UTC (rev 3782)
@@ -0,0 +1,46 @@
+''' Test functions for factorial, comb functions '''
+
+from scipy.testing import *
+import numpy as np
+from scipy.misc import factorial, comb
+
+
+class test_factorial(TestCase):
+ def test_basic(self):
+ for k in range(0,13):
+ assert_equal(factorial(k),
+ np.product(np.arange(1,k+1),axis=0))
+ assert_equal(factorial(-10), 0)
+
+ def test_exact(self):
+ resdict = {4:24L,10:3628800L,15:1307674368000L,
+ 19:121645100408832000L,
+ 100:93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000L}
+ for key in resdict.keys():
+ assert_equal(factorial(key,exact=1),resdict[key])
+
+
+class test_comb(TestCase):
+
+ def test_basic(self):
+ for N in range(0,11):
+ for k in range(0,N+1):
+ ans = np.product(np.arange(N-k+1,N+1),axis=0) \
+ / np.product(np.arange(1,k+1),axis=0)
+ assert_almost_equal(comb(N,k),ans,9)
+ assert(comb(-10,1) == 0)
+ assert(comb(10,-1) == 0)
+ assert(comb(-10,-3) == 0)
+ assert(comb(10,11) == 0)
+
+ def test_exact(self):
+ resdict = {(10,2):45L, (10,5):252L,
+ (1000,20):339482811302457603895512614793686020778700L,
+ (1000,975):47641862536236518640933948075167736642053976275040L
+ }
+ for key in resdict.keys():
+ assert_equal(comb(key[0],key[1],exact=1),resdict[key])
+
+
+if __name__ == '__main__':
+ unittest.main()
Modified: branches/testing_cleanup/scipy/optimize/tests/test_slsqp.py
===================================================================
--- branches/testing_cleanup/scipy/optimize/tests/test_slsqp.py 2008-01-04 12:29:00 UTC (rev 3781)
+++ branches/testing_cleanup/scipy/optimize/tests/test_slsqp.py 2008-01-04 21:27:41 UTC (rev 3782)
@@ -83,7 +83,7 @@
ieqcons = [lambda x, y: x[0]-x[1]-1.0],
iprint=0, full_output=1)
x,fx,its,imode,smode = res
- assert_array_almost_equal(x,[2,1])
+ assert_array_almost_equal(x,[2,1],decimal=3)
if __name__ == "__main__":
unittest.main()
Modified: branches/testing_cleanup/scipy/sparse/tests/test_base.py
===================================================================
--- branches/testing_cleanup/scipy/sparse/tests/test_base.py 2008-01-04 12:29:00 UTC (rev 3781)
+++ branches/testing_cleanup/scipy/sparse/tests/test_base.py 2008-01-04 21:27:41 UTC (rev 3782)
@@ -304,7 +304,7 @@
assert_equal( result.shape, (4,2) )
assert_equal( result, dot(a,b) )
- def check_formatconversions(self):
+ def test_formatconversions(self):
A = spkron([[1,0,1],[0,1,1],[1,0,0]], [[1,1],[0,1]] )
D = A.todense()
A = self.spmatrix(A)
More information about the Scipy-svn
mailing list