summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-01-09 18:53:06 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-01-09 18:53:06 (GMT)
commita28e7028f99701c4f216dfbe4fcdf5f00cfee7e0 (patch)
tree6c72f6b5ab7ed8304175cdeed797c846ffaeae2b /Lib/test
parent46a9900e099a82cda7328b0de16d6fffe52ee62a (diff)
downloadcpython-a28e7028f99701c4f216dfbe4fcdf5f00cfee7e0.zip
cpython-a28e7028f99701c4f216dfbe4fcdf5f00cfee7e0.tar.gz
cpython-a28e7028f99701c4f216dfbe4fcdf5f00cfee7e0.tar.bz2
Merged revisions 77185-77188,77262,77313,77317,77331-77333,77337-77338 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77185 | andrew.kuchling | 2009-12-31 10:17:05 -0600 (Thu, 31 Dec 2009) | 1 line Add some items ........ r77186 | benjamin.peterson | 2009-12-31 10:28:24 -0600 (Thu, 31 Dec 2009) | 1 line update expat comment ........ r77187 | andrew.kuchling | 2009-12-31 10:38:53 -0600 (Thu, 31 Dec 2009) | 1 line Add various items ........ r77188 | benjamin.peterson | 2009-12-31 10:49:37 -0600 (Thu, 31 Dec 2009) | 1 line add another advancement ........ r77262 | andrew.kuchling | 2010-01-02 19:15:21 -0600 (Sat, 02 Jan 2010) | 1 line Add a few items ........ r77313 | benjamin.peterson | 2010-01-04 18:04:19 -0600 (Mon, 04 Jan 2010) | 1 line add a test about hashing array.array ........ r77317 | georg.brandl | 2010-01-05 12:14:52 -0600 (Tue, 05 Jan 2010) | 1 line Add Stefan. ........ r77331 | georg.brandl | 2010-01-06 11:43:06 -0600 (Wed, 06 Jan 2010) | 1 line Small fixes to test_cmd: fix signature of do_shell, remove duplicate import, add option to run the custom Cmd class. ........ r77332 | georg.brandl | 2010-01-06 12:02:16 -0600 (Wed, 06 Jan 2010) | 7 lines #5991: let completion for the "help" command include help topics. This also simplifies the Cmd.get_names() method implementation; it was written at a time where dir() didn't consider base class attributes. ........ r77333 | georg.brandl | 2010-01-06 12:26:08 -0600 (Wed, 06 Jan 2010) | 1 line #5950: document that zip files with comments are unsupported in zipimport. ........ r77337 | r.david.murray | 2010-01-06 21:09:08 -0600 (Wed, 06 Jan 2010) | 3 lines Add -W to the 'basics', 'opt', and 'all' test runs so that we get verbose information if a failure happens. ........ r77338 | r.david.murray | 2010-01-06 22:04:28 -0600 (Wed, 06 Jan 2010) | 2 lines Fix inadvertent checkin of debug line. ........
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_cmd.py11
-rw-r--r--Lib/test/test_hashlib.py9
2 files changed, 17 insertions, 3 deletions
diff --git a/Lib/test/test_cmd.py b/Lib/test/test_cmd.py
index e2b3022..f102fe0 100644
--- a/Lib/test/test_cmd.py
+++ b/Lib/test/test_cmd.py
@@ -60,15 +60,17 @@ class samplecmdclass(cmd.Cmd):
>>> mycmd.completenames("12")
[]
>>> mycmd.completenames("help")
- ['help', 'help']
+ ['help']
Test for the function complete_help():
>>> mycmd.complete_help("a")
['add']
>>> mycmd.complete_help("he")
- ['help', 'help']
+ ['help']
>>> mycmd.complete_help("12")
[]
+ >>> sorted(mycmd.complete_help(""))
+ ['add', 'exit', 'help', 'shell']
Test for the function do_help():
>>> mycmd.do_help("testet")
@@ -144,7 +146,7 @@ class samplecmdclass(cmd.Cmd):
def complete_command(self):
print("complete command")
- def do_shell(self):
+ def do_shell(self, s):
pass
def do_add(self, s):
@@ -171,6 +173,7 @@ def test_main(verbose=None):
support.run_doctest(test_cmd, verbose)
def test_coverage(coverdir):
+ import trace
tracer=trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,],
trace=0, count=1)
tracer.run('reload(cmd);test_main()')
@@ -181,5 +184,7 @@ def test_coverage(coverdir):
if __name__ == "__main__":
if "-c" in sys.argv:
test_coverage('/tmp/cmd.cover')
+ elif "-i" in sys.argv:
+ samplecmdclass().cmdloop()
else:
test_main()
diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py
index 2857737..7d58da9 100644
--- a/Lib/test/test_hashlib.py
+++ b/Lib/test/test_hashlib.py
@@ -6,8 +6,10 @@
# Licensed to PSF under a Contributor Agreement.
#
+import array
import hashlib
from io import StringIO
+import itertools
import sys
try:
import threading
@@ -93,6 +95,13 @@ class HashLibTestCase(unittest.TestCase):
super(HashLibTestCase, self).__init__(*args, **kwargs)
+ def test_hash_array(self):
+ a = array.array("b", range(10))
+ constructors = self.constructors_to_test.values()
+ for cons in itertools.chain.from_iterable(constructors):
+ c = cons(a)
+ c.hexdigest()
+
def test_unknown_hash(self):
try:
hashlib.new('spam spam spam spam spam')