mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
- Changed output of DocTestParser.get_program() to make it easier to
visually distinguish the expected output from the comments (use "##" to mark expected outputs, and "#" to mark comments). - If the string given to DocTestParser.get_program() is indented, then strip its indentation. (In particular, find the min indentation of non-blank lines, and strip that indentation from all lines.)
This commit is contained in:
parent
8e4a34ba09
commit
a5db6009fe
2 changed files with 37 additions and 23 deletions
|
@ -1053,30 +1053,30 @@ words and expected output are converted to comments:
|
|||
>>> import test.test_doctest
|
||||
>>> name = 'test.test_doctest.sample_func'
|
||||
>>> print doctest.testsource(test.test_doctest, name)
|
||||
# Blah blah
|
||||
# Blah blah
|
||||
#
|
||||
print sample_func(22)
|
||||
# Expected:
|
||||
# 44
|
||||
## 44
|
||||
#
|
||||
# Yee ha!
|
||||
# Yee ha!
|
||||
|
||||
>>> name = 'test.test_doctest.SampleNewStyleClass'
|
||||
>>> print doctest.testsource(test.test_doctest, name)
|
||||
print '1\n2\n3'
|
||||
# Expected:
|
||||
# 1
|
||||
# 2
|
||||
# 3
|
||||
## 1
|
||||
## 2
|
||||
## 3
|
||||
|
||||
>>> name = 'test.test_doctest.SampleClass.a_classmethod'
|
||||
>>> print doctest.testsource(test.test_doctest, name)
|
||||
print SampleClass.a_classmethod(10)
|
||||
# Expected:
|
||||
# 12
|
||||
## 12
|
||||
print SampleClass(0).a_classmethod(10)
|
||||
# Expected:
|
||||
# 12
|
||||
## 12
|
||||
"""
|
||||
|
||||
def test_debug(): r"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue