summaryrefslogtreecommitdiff
path: root/Lib/test/test_b2.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-11-08 15:05:21 +0000
committerGuido van Rossum <guido@python.org>1993-11-08 15:05:21 +0000
commite65cce5eec23812d77a54095209c923937cc3c92 (patch)
treeed0b87870ad9c6278e43acf63685b8823cce018c /Lib/test/test_b2.py
parentdb65a6ce556b1e311d03837fbf85ca52ef2c5d07 (diff)
downloadcpython-git-e65cce5eec23812d77a54095209c923937cc3c92.tar.gz
* string.py: added rindex(), rfind(); changed index() to interpret
negative start indices starting from the right. * ftplib.py: debug() -> set_debuglevel(); change demo to use __init__(). * os.py: added execl, execlp, and execvp. * lambda.py: removed (now that we have built-in map, reduce, bagof, lambda) * test_b{1,2}.py, testall.out: added tests for bagof, lambda, map, reduce * commands.py: use os, not posix * test_grammar.py: make it easy to disable non-portable int overflow tests * dis.py: don't abuse range()
Diffstat (limited to 'Lib/test/test_b2.py')
-rw-r--r--Lib/test/test_b2.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_b2.py b/Lib/test/test_b2.py
index ca06049c3e..037955ea15 100644
--- a/Lib/test/test_b2.py
+++ b/Lib/test/test_b2.py
@@ -111,6 +111,16 @@ finally:
sys.stdin = savestdin
fp.close()
+print 'reduce'
+if reduce('x,y:x+y', ['a', 'b', 'c'], '') <> 'abc':
+ raise TestFailed, 'reduce(): implode a string'
+if reduce('x,y:x+y', [['a', 'c'], [], ['d', 'w']], []) <> ['a','c','d','w']:
+ raise TestFailed, 'reduce(): append'
+if reduce('x,y: x*y', range(2,8), 1) <> 5040:
+ raise TestFailed, 'reduce(): compute 7!'
+if reduce('x,y:x*y', range(2,21), 1L) <> 2432902008176640000L:
+ raise TestFailed, 'reduce(): compute 20!, use long'
+
print 'reload'
import string
reload(string)