Fixed bug in line-number finding for examples (DocTestParser wasn't

updating line numbers correctly for bare prompts & examples containing
only comments).
This commit is contained in:
Edward Loper 2004-08-17 16:37:12 +00:00
parent f04d8a8898
commit b51b23405b
2 changed files with 28 additions and 7 deletions

View file

@ -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.