[Python-checkins] python/dist/src/Lib doctest.py,1.48,1.49
tim_one at users.sourceforge.net
tim_one at users.sourceforge.net
Mon Aug 9 05:28:48 CEST 2004
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10393/Lib
Modified Files:
doctest.py
Log Message:
Indent body of _EXAMPLE_RE for readability. _IS_BLANK_OR_COMMENT makes
more sense as a callable.
Index: doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** doctest.py 9 Aug 2004 02:56:02 -0000 1.48
--- doctest.py 9 Aug 2004 03:28:45 -0000 1.49
***************
*** 591,606 ****
_EXAMPLE_RE = re.compile(r'''
! # Source consists of a PS1 line followed by zero or more PS2 lines.
! (?P<source>
! (?:^(?P<indent> [ ]*) >>> .*) # PS1 line
! (?:\n [ ]* \.\.\. .*)*) # PS2 lines
! \n?
! # Want consists of any non-blank lines that do not start with PS1.
! (?P<want> (?:(?![ ]*$) # Not a blank line
! (?![ ]*>>>) # Not a line starting with PS1
! .*$\n? # But any other line
! )*)
! ''', re.MULTILINE | re.VERBOSE)
! _IS_BLANK_OR_COMMENT = re.compile('^[ ]*(#.*)?$')
def get_examples(self):
--- 591,606 ----
_EXAMPLE_RE = re.compile(r'''
! # Source consists of a PS1 line followed by zero or more PS2 lines.
! (?P<source>
! (?:^(?P<indent> [ ]*) >>> .*) # PS1 line
! (?:\n [ ]* \.\.\. .*)*) # PS2 lines
! \n?
! # Want consists of any non-blank lines that do not start with PS1.
! (?P<want> (?:(?![ ]*$) # Not a blank line
! (?![ ]*>>>) # Not a line starting with PS1
! .*$\n? # But any other line
! )*)
! ''', re.MULTILINE | re.VERBOSE)
! _IS_BLANK_OR_COMMENT = re.compile('^[ ]*(#.*)?$').match
def get_examples(self):
***************
*** 639,643 ****
# Extract source/want from the regexp match.
(source, want) = self._parse_example(m, lineno)
! if self._IS_BLANK_OR_COMMENT.match(source):
continue
examples.append( Example(source, want, lineno) )
--- 639,643 ----
# Extract source/want from the regexp match.
(source, want) = self._parse_example(m, lineno)
! if self._IS_BLANK_OR_COMMENT(source):
continue
examples.append( Example(source, want, lineno) )
More information about the Python-checkins
mailing list