[Scipy-svn] r4504 - trunk/scipy/sandbox/mkufunc

scipy-svn@scip... scipy-svn@scip...
Mon Jun 30 09:08:54 CDT 2008


Author: ilan
Date: 2008-06-30 09:08:53 -0500 (Mon, 30 Jun 2008)
New Revision: 4504

Modified:
   trunk/scipy/sandbox/mkufunc/test_mkufunc.py
Log:
Added test for function with no args

Modified: trunk/scipy/sandbox/mkufunc/test_mkufunc.py
===================================================================
--- trunk/scipy/sandbox/mkufunc/test_mkufunc.py	2008-06-30 03:19:29 UTC (rev 4503)
+++ trunk/scipy/sandbox/mkufunc/test_mkufunc.py	2008-06-30 14:08:53 UTC (rev 4504)
@@ -181,16 +181,23 @@
         uf = mkufunc(f)
         x = arange(0, 2, 0.1)
         self.assertClose(uf(x), f(x))
+
+
+class FuncArg_Tests(unittest.TestCase, Util):
     
-        def f(x, y, z):
-            return x * y * z
+    def test_fargs0(self):
+        def f():
+            return 42
+        
         uf = mkufunc(f)
-        x = arange(0, 1, 0.1)
-        y = 2 * x
-        z = 3 * x
-        self.assertClose(uf(x, y, z), f(x, y, z))
+        self.assertEqual(uf(), 42)
+        self.assert_(type(uf()).__name__.startswith('float'))
 
+        uf = mkufunc(int)(f)
+        self.assertEqual(uf(), 42)
+        self.assert_(type(uf()).__name__.startswith('int'))
 
+
 class Control_Flow_Tests(unittest.TestCase):
 
     def test_if(self):



More information about the Scipy-svn mailing list