diff options
author | Edward Loper <edloper@gradient.cis.upenn.edu> | 2004-08-17 16:37:12 (GMT) |
---|---|---|
committer | Edward Loper <edloper@gradient.cis.upenn.edu> | 2004-08-17 16:37:12 (GMT) |
commit | b51b23405b6cf82ab4ec20f3d5ef4b895bd0786f (patch) | |
tree | 69730ef8142ad40994b77bb1ac4524c318219150 /Lib/doctest.py | |
parent | f04d8a88989f04b8ccb7ca4992190d0eff4352a1 (diff) | |
download | cpython-b51b23405b6cf82ab4ec20f3d5ef4b895bd0786f.zip cpython-b51b23405b6cf82ab4ec20f3d5ef4b895bd0786f.tar.gz cpython-b51b23405b6cf82ab4ec20f3d5ef4b895bd0786f.tar.bz2 |
Fixed bug in line-number finding for examples (DocTestParser wasn't
updating line numbers correctly for bare prompts & examples containing
only comments).
Diffstat (limited to 'Lib/doctest.py')
-rw-r--r-- | Lib/doctest.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py index aa523a6..c033b0d 100644 --- a/Lib/doctest.py +++ b/Lib/doctest.py @@ -552,12 +552,10 @@ class DocTestParser: (source, want) = self._parse_example(m, name, lineno) # Extract extra options from the source. options = self._find_options(source, name, lineno) - # If it contains no real source, then ignore it. - if self._IS_BLANK_OR_COMMENT(source): - continue # Create an Example, and add it to the list. - examples.append( Example(source, want, lineno, - len(m.group('indent')), options) ) + if not self._IS_BLANK_OR_COMMENT(source): + examples.append( Example(source, want, lineno, + len(m.group('indent')), options) ) # Update lineno (lines inside this example) lineno += string.count('\n', m.start(), m.end()) # Update charno. |