[Scipy-svn] r3292 - in branches/0.6.x/scipy: misc/tests sparse/tests

scipy-svn@scip... scipy-svn@scip...
Thu Aug 30 03:14:43 CDT 2007


Author: stefan
Date: 2007-08-30 03:13:39 -0500 (Thu, 30 Aug 2007)
New Revision: 3292

Modified:
   branches/0.6.x/scipy/misc/tests/test_pilutil.py
   branches/0.6.x/scipy/sparse/tests/test_sparse.py
Log:
Change parametric tests to normal tests.


Modified: branches/0.6.x/scipy/misc/tests/test_pilutil.py
===================================================================
--- branches/0.6.x/scipy/misc/tests/test_pilutil.py	2007-08-30 01:57:01 UTC (rev 3291)
+++ branches/0.6.x/scipy/misc/tests/test_pilutil.py	2007-08-30 08:13:39 UTC (rev 3292)
@@ -8,9 +8,9 @@
 import os.path
 import numpy as N
 
-datapath = os.path.dirname(__file__)
+datapath = os.path.join(os.path.dirname(__file__),'data')
 
-class test_pilutil(ParametricTestCase):
+class test_pilutil(NumpyTestCase):
     def test_imresize(self):
         im = N.random.random((10,20))
         for T in N.sctypes['float'] + [float]:
@@ -23,19 +23,16 @@
         assert_equal(pilutil.bytescale(x),x)
         assert_equal(pilutil.bytescale(y),[0,127,255])
 
-    def tst_fromimage(self,filename,irange):
-        img = pilutil.fromimage(PIL.Image.open(filename))
-        imin,imax = irange
-        assert img.min() >= imin
-        assert img.max() <= imax
-
-    def testip_fromimage(self):
+    def test_fromimage(self):
         data = {'icon.png':(0,255),
                 'icon_mono.png':(0,2),
                 'icon_mono_flat.png':(0,1)}
 
-        return ((self.tst_fromimage,os.path.join(datapath,'data',fn),irange)
-                for fn,irange in data.iteritems())
+        for fn,irange in data.iteritems():
+            img = pilutil.fromimage(PIL.Image.open(os.path.join(datapath,fn)))
+            imin,imax = irange
+            assert img.min() >= imin
+            assert img.max() <= imax
 
 if __name__ == "__main__":
     NumpyTest().run()

Modified: branches/0.6.x/scipy/sparse/tests/test_sparse.py
===================================================================
--- branches/0.6.x/scipy/sparse/tests/test_sparse.py	2007-08-30 01:57:01 UTC (rev 3291)
+++ branches/0.6.x/scipy/sparse/tests/test_sparse.py	2007-08-30 08:13:39 UTC (rev 3292)
@@ -789,8 +789,7 @@
         assert_equal(caught,5)
 
 
-class test_lil(_test_cs, _test_horiz_slicing, NumpyTestCase,
-               ParametricTestCase):
+class test_lil(_test_cs, _test_horiz_slicing, NumpyTestCase):
     spmatrix = lil_matrix
 
     B = lil_matrix((4,3))
@@ -840,14 +839,7 @@
         B[0,:] = A[0,:]
         assert_array_equal(A[0,:].A, B[0,:].A)
 
-    def tst_inplace_op(self,op,arr,other,result):
-        cpy = arr
-        getattr(arr,"__i%s__" % op)(other)
-
-        assert_array_equal(cpy.todense(),arr.todense())
-        assert_array_equal(arr.todense(),result)
-
-    def testip_inplace_ops(self):
+    def test_inplace_ops(self):
         B = self.B[:3,:3].copy()
         B[:,:] = B-B
         C = B.todense()
@@ -856,9 +848,14 @@
                 'sub':(B,zeros(B.shape)),
                 'mul':(3,C*3)}
 
-        return [(self.tst_inplace_op,op,B,other,result)
-                for op,(other,result) in data.iteritems()]
+        for op,(other,result) in data.iteritems():
+            arr = B.copy()
+            cpy = arr
+            getattr(arr,"__i%s__" % op)(other)
 
+            assert_array_equal(cpy.todense(),arr.todense())
+            assert_array_equal(arr.todense(),result)
+
     def check_lil_slice_assignment(self):
         B = lil_matrix((4,3))
         B[0,0] = 5



More information about the Scipy-svn mailing list