[pypy-svn] rev 706 - pypy/trunk/src/pypy/module/test
lac at codespeak.net
lac at codespeak.net
Thu May 29 17:48:37 CEST 2003
Author: lac
Date: Thu May 29 17:48:37 2003
New Revision: 706
Added:
pypy/trunk/src/pypy/module/test/test_reduce.py
Log:
test_functional has now become test_map, test_filter, test_zip and test_reduce.
test_reduce is the last one, so now test_functional can go away.
Added: pypy/trunk/src/pypy/module/test/test_reduce.py
==============================================================================
--- (empty file)
+++ pypy/trunk/src/pypy/module/test/test_reduce.py Thu May 29 17:48:37 2003
@@ -0,0 +1,19 @@
+import testsupport
+from pypy.module.builtin_app import reduce
+
+class TestReduce(testsupport.TestCase):
+ def test_None(self):
+ self.assertRaises(TypeError, reduce, lambda x, y: x+y, [1,2,3], None)
+
+ def test_sum(self):
+ self.assertEqual(reduce(lambda x, y: x+y, [1,2,3,4], 0), 10)
+ self.assertEqual(reduce(lambda x, y: x+y, [1,2,3,4]), 10)
+
+ def test_minus(self):
+ self.assertEqual(reduce(lambda x, y: x-y, [10, 2, 8]), 0)
+ self.assertEqual(reduce(lambda x, y: x-y, [2, 8], 10), 0)
+
+if __name__ == '__main__':
+ testsupport.main()
+
+
More information about the Pypy-commit
mailing list