diff options
author | Guido van Rossum <guido@python.org> | 2006-08-22 00:21:25 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-08-22 00:21:25 (GMT) |
commit | 89da5d7c3d9cf5bfd4a374e23fd924bbffdeaf5c (patch) | |
tree | aef767c70a3b57c4128d44816e4e070d28fffb9d /Lib/test/test_builtin.py | |
parent | 6cefeb0e8156406ac3f99248f6a3d3cd1536ca23 (diff) | |
download | cpython-89da5d7c3d9cf5bfd4a374e23fd924bbffdeaf5c.zip cpython-89da5d7c3d9cf5bfd4a374e23fd924bbffdeaf5c.tar.gz cpython-89da5d7c3d9cf5bfd4a374e23fd924bbffdeaf5c.tar.bz2 |
Kill reduce(). A coproduction of John Reese, Jacques Frechet, and Alex M.
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r-- | Lib/test/test_builtin.py | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 13a5241..b0dbd4a 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -1393,32 +1393,6 @@ class BuiltinTest(unittest.TestCase): self.assertRaises(OverflowError, range, -sys.maxint, sys.maxint) self.assertRaises(OverflowError, range, 0, 2*sys.maxint) - def test_reduce(self): - self.assertEqual(reduce(lambda x, y: x+y, ['a', 'b', 'c'], ''), 'abc') - self.assertEqual( - reduce(lambda x, y: x+y, [['a', 'c'], [], ['d', 'w']], []), - ['a','c','d','w'] - ) - self.assertEqual(reduce(lambda x, y: x*y, range(2,8), 1), 5040) - self.assertEqual( - reduce(lambda x, y: x*y, range(2,21), 1L), - 2432902008176640000L - ) - self.assertEqual(reduce(lambda x, y: x+y, Squares(10)), 285) - self.assertEqual(reduce(lambda x, y: x+y, Squares(10), 0), 285) - self.assertEqual(reduce(lambda x, y: x+y, Squares(0), 0), 0) - self.assertRaises(TypeError, reduce) - self.assertRaises(TypeError, reduce, 42, 42) - self.assertRaises(TypeError, reduce, 42, 42, 42) - self.assertEqual(reduce(42, "1"), "1") # func is never called with one item - self.assertEqual(reduce(42, "", "1"), "1") # func is never called with one item - self.assertRaises(TypeError, reduce, 42, (42, 42)) - - class BadSeq: - def __getitem__(self, index): - raise ValueError - self.assertRaises(ValueError, reduce, 42, BadSeq()) - def test_reload(self): import marshal reload(marshal) |