[Python-checkins] python/dist/src/Lib doctest.py,1.36.2.6,1.36.2.7
tim_one at users.sourceforge.net
tim_one at users.sourceforge.net
Tue Aug 3 21:12:14 CEST 2004
- Previous message: [Python-checkins] python/dist/src/Lib/distutils/tests support.py,
1.1, 1.2 test_build_py.py, 1.3, 1.4 test_build_scripts.py, 1.2,
1.3 test_install_scripts.py, 1.4, 1.5
- Next message: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.135,
1.831.4.136
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21250/Lib
Modified Files:
Tag: tim-doctest-branch
doctest.py
Log Message:
Put all 'return' statements on their own line. The control flow is
harder to see otherwise, and you can't set a breakpoint on the
'return' otherwise.
Index: doctest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v
retrieving revision 1.36.2.6
retrieving revision 1.36.2.7
diff -C2 -d -r1.36.2.6 -r1.36.2.7
*** doctest.py 3 Aug 2004 18:45:24 -0000 1.36.2.6
--- doctest.py 3 Aug 2004 19:12:09 -0000 1.36.2.7
***************
*** 605,609 ****
# This lets us sort tests by name:
def __cmp__(self, other):
! if not isinstance(other, DocTest): return -1
return cmp((self.name, self.filename, self.lineno, id(self)),
(other.name, other.filename, other.lineno, id(other)))
--- 605,610 ----
# This lets us sort tests by name:
def __cmp__(self, other):
! if not isinstance(other, DocTest):
! return -1
return cmp((self.name, self.filename, self.lineno, id(self)),
(other.name, other.filename, other.lineno, id(other)))
***************
*** 688,692 ****
file = inspect.getsourcefile(obj) or inspect.getfile(obj)
source_lines = linecache.getlines(file)
! if not source_lines: source_lines = None
except TypeError:
source_lines = None
--- 689,694 ----
file = inspect.getsourcefile(obj) or inspect.getfile(obj)
source_lines = linecache.getlines(file)
! if not source_lines:
! source_lines = None
except TypeError:
source_lines = None
***************
*** 731,740 ****
# If we've already processed this object, then ignore it.
! if id(obj) in seen: return
seen[id(obj)] = 1
# Find a test for this object, and add it to the list of tests.
test = self._get_test(obj, name, module, source_lines)
! if test is not None: tests.append(test)
# Look for tests in a module's contained objects.
--- 733,744 ----
# If we've already processed this object, then ignore it.
! if id(obj) in seen:
! return
seen[id(obj)] = 1
# Find a test for this object, and add it to the list of tests.
test = self._get_test(obj, name, module, source_lines)
! if test is not None:
! tests.append(test)
# Look for tests in a module's contained objects.
***************
*** 798,802 ****
else:
try:
! if obj.__doc__ is None: return None
docstring = str(obj.__doc__)
except (TypeError, AttributeError):
--- 802,807 ----
else:
try:
! if obj.__doc__ is None:
! return None
docstring = str(obj.__doc__)
except (TypeError, AttributeError):
***************
*** 804,808 ****
# Don't bother if the docstring is empty.
! if not docstring: return None
# Find the docstring's location in the file.
--- 809,814 ----
# Don't bother if the docstring is empty.
! if not docstring:
! return None
# Find the docstring's location in the file.
***************
*** 831,835 ****
# times in a single file.
if inspect.isclass(obj):
! if source_lines is None: return None
pat = re.compile(r'^\s*class\s*%s\b' %
getattr(obj, '__name__', '-'))
--- 837,842 ----
# times in a single file.
if inspect.isclass(obj):
! if source_lines is None:
! return None
pat = re.compile(r'^\s*class\s*%s\b' %
getattr(obj, '__name__', '-'))
***************
*** 853,857 ****
# mark.
if lineno is not None:
! if source_lines is None: return lineno+1
pat = re.compile('(^|.*:)\s*\w*("|\')')
for lineno in range(lineno, len(source_lines)):
--- 860,865 ----
# mark.
if lineno is not None:
! if source_lines is None:
! return lineno+1
pat = re.compile('(^|.*:)\s*\w*("|\')')
for lineno in range(lineno, len(source_lines)):
***************
*** 973,983 ****
# Handle the common case first, for efficiency:
# if they're string-identical, always return true.
! if got == want: return True
# The values True and False replaced 1 and 0 as the return
# value for boolean comparisons in Python 2.3.
if not (self._optionflags & DONT_ACCEPT_TRUE_FOR_1):
! if (got,want) == ("True\n", "1\n"): return True
! if (got,want) == ("False\n", "0\n"): return True
# <BLANKLINE> can be used as a special sequence to signify a
--- 981,994 ----
# Handle the common case first, for efficiency:
# if they're string-identical, always return true.
! if got == want:
! return True
# The values True and False replaced 1 and 0 as the return
# value for boolean comparisons in Python 2.3.
if not (self._optionflags & DONT_ACCEPT_TRUE_FOR_1):
! if (got,want) == ("True\n", "1\n"):
! return True
! if (got,want) == ("False\n", "0\n"):
! return True
# <BLANKLINE> can be used as a special sequence to signify a
***************
*** 990,994 ****
# spaces.
got = re.sub('(?m)^\s*?$', '', got)
! if got == want: return True
# This flag causes doctest to ignore any differences in the
--- 1001,1006 ----
# spaces.
got = re.sub('(?m)^\s*?$', '', got)
! if got == want:
! return True
# This flag causes doctest to ignore any differences in the
***************
*** 998,1002 ****
got = ' '.join(got.split())
want = ' '.join(want.split())
! if got == want: return True
# The ELLIPSIS flag says to let the sequence "..." in `want`
--- 1010,1015 ----
got = ' '.join(got.split())
want = ' '.join(want.split())
! if got == want:
! return True
# The ELLIPSIS flag says to let the sequence "..." in `want`
***************
*** 1012,1016 ****
want_re = '(?s)^%s$' % want_re
# Check if the `want_re` regexp matches got.
! if re.match(want_re, got): return True
# We didn't find any match; return false.
--- 1025,1030 ----
want_re = '(?s)^%s$' % want_re
# Check if the `want_re` regexp matches got.
! if re.match(want_re, got):
! return True
# We didn't find any match; return false.
***************
*** 1141,1145 ****
"""
m = self._OPTION_DIRECTIVE_RE.match(example.source)
! if m is None: return False
for flag in m.group('flags').upper().split():
--- 1155,1160 ----
"""
m = self._OPTION_DIRECTIVE_RE.match(example.source)
! if m is None:
! return False
for flag in m.group('flags').upper().split():
- Previous message: [Python-checkins] python/dist/src/Lib/distutils/tests support.py,
1.1, 1.2 test_build_py.py, 1.3, 1.4 test_build_scripts.py, 1.2,
1.3 test_install_scripts.py, 1.4, 1.5
- Next message: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.135,
1.831.4.136
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Python-checkins
mailing list