mirror of
https://github.com/python/cpython.git
synced 2025-10-13 02:13:03 +00:00
Fix most trivially-findable print statements.
There's one major and one minor category still unfixed: doctests are the major category (and I hope to be able to augment the refactoring tool to refactor bona fide doctests soon); other code generating print statements in strings is the minor category. (Oh, and I don't know if the compiler package works.)
This commit is contained in:
parent
452bf519a7
commit
be19ed77dd
331 changed files with 2567 additions and 2648 deletions
|
@ -855,7 +855,7 @@ class DocTestFinder:
|
|||
add them to `tests`.
|
||||
"""
|
||||
if self._verbose:
|
||||
print 'Finding tests in %s' % name
|
||||
print('Finding tests in %s' % name)
|
||||
|
||||
# If we've already processed this object, then ignore it.
|
||||
if id(obj) in seen:
|
||||
|
@ -1384,28 +1384,28 @@ class DocTestRunner:
|
|||
failed.append(x)
|
||||
if verbose:
|
||||
if notests:
|
||||
print len(notests), "items had no tests:"
|
||||
print(len(notests), "items had no tests:")
|
||||
notests.sort()
|
||||
for thing in notests:
|
||||
print " ", thing
|
||||
print(" ", thing)
|
||||
if passed:
|
||||
print len(passed), "items passed all tests:"
|
||||
print(len(passed), "items passed all tests:")
|
||||
passed.sort()
|
||||
for thing, count in passed:
|
||||
print " %3d tests in %s" % (count, thing)
|
||||
print(" %3d tests in %s" % (count, thing))
|
||||
if failed:
|
||||
print self.DIVIDER
|
||||
print len(failed), "items had failures:"
|
||||
print(self.DIVIDER)
|
||||
print(len(failed), "items had failures:")
|
||||
failed.sort()
|
||||
for thing, (f, t) in failed:
|
||||
print " %3d of %3d in %s" % (f, t, thing)
|
||||
print(" %3d of %3d in %s" % (f, t, thing))
|
||||
if verbose:
|
||||
print totalt, "tests in", len(self._name2ft), "items."
|
||||
print totalt - totalf, "passed and", totalf, "failed."
|
||||
print(totalt, "tests in", len(self._name2ft), "items.")
|
||||
print(totalt - totalf, "passed and", totalf, "failed.")
|
||||
if totalf:
|
||||
print "***Test Failed***", totalf, "failures."
|
||||
print("***Test Failed***", totalf, "failures.")
|
||||
elif verbose:
|
||||
print "Test passed."
|
||||
print("Test passed.")
|
||||
return totalf, totalt
|
||||
|
||||
#/////////////////////////////////////////////////////////////////
|
||||
|
@ -1415,8 +1415,8 @@ class DocTestRunner:
|
|||
d = self._name2ft
|
||||
for name, (f, t) in other._name2ft.items():
|
||||
if name in d:
|
||||
print "*** DocTestRunner.merge: '" + name + "' in both" \
|
||||
" testers; summing outcomes."
|
||||
print("*** DocTestRunner.merge: '" + name + "' in both" \
|
||||
" testers; summing outcomes.")
|
||||
f2, t2 = d[name]
|
||||
f = f + f2
|
||||
t = t + t2
|
||||
|
@ -1985,10 +1985,10 @@ class Tester:
|
|||
def runstring(self, s, name):
|
||||
test = DocTestParser().get_doctest(s, self.globs, name, None, None)
|
||||
if self.verbose:
|
||||
print "Running string", name
|
||||
print("Running string", name)
|
||||
(f,t) = self.testrunner.run(test)
|
||||
if self.verbose:
|
||||
print f, "of", t, "examples failed in string", name
|
||||
print(f, "of", t, "examples failed in string", name)
|
||||
return (f,t)
|
||||
|
||||
def rundoc(self, object, name=None, module=None):
|
||||
|
@ -2512,7 +2512,7 @@ def debug_script(src, pm=False, globs=None):
|
|||
try:
|
||||
execfile(srcfilename, globs, globs)
|
||||
except:
|
||||
print sys.exc_info()[1]
|
||||
print(sys.exc_info()[1])
|
||||
pdb.post_mortem(sys.exc_info()[2])
|
||||
else:
|
||||
# Note that %r is vital here. '%s' instead can, e.g., cause
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue