diff options
author | Georg Brandl <georg@python.org> | 2009-09-16 16:36:39 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-09-16 16:36:39 (GMT) |
commit | 69dfe8d80ed77215b4bfe84138ef070d6c0c7b16 (patch) | |
tree | 34ac19b65de337bcf67a3cdeb7615fe7e8da437c /Lib/test | |
parent | 6c39f06ab2a85ba21b87f156ad3e3010feed7bda (diff) | |
download | cpython-69dfe8d80ed77215b4bfe84138ef070d6c0c7b16.zip cpython-69dfe8d80ed77215b4bfe84138ef070d6c0c7b16.tar.gz cpython-69dfe8d80ed77215b4bfe84138ef070d6c0c7b16.tar.bz2 |
Make the pdb displayhook compatible with the standard displayhook: do not print Nones. Add a test for that.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_pdb.py | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index a15538c..6017edc 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -26,6 +26,38 @@ class PdbTestInput(object): sys.stdin = self.real_stdin +def write(x): + print x + +def test_pdb_displayhook(): + """This tests the custom displayhook for pdb. + + >>> def test_function(foo, bar): + ... import pdb; pdb.Pdb().set_trace() + ... pass + + >>> with PdbTestInput([ + ... 'foo', + ... 'bar', + ... 'for i in range(5): write(i)', + ... 'continue', + ... ]): + ... test_function(1, None) + > <doctest test.test_pdb.test_pdb_displayhook[0]>(3)test_function() + -> pass + (Pdb) foo + 1 + (Pdb) bar + (Pdb) for i in range(5): write(i) + 0 + 1 + 2 + 3 + 4 + (Pdb) continue + """ + + def test_pdb_skip_modules(): """This illustrates the simple case of module skipping. @@ -36,7 +68,7 @@ def test_pdb_skip_modules(): >>> with PdbTestInput([ ... 'step', - ... 'continue' + ... 'continue', ... ]): ... skip_module() > <doctest test.test_pdb.test_pdb_skip_modules[0]>(4)skip_module() |