mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +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
|
@ -40,7 +40,7 @@ def escapestr(text, ampm):
|
|||
|
||||
def strftest(now):
|
||||
if verbose:
|
||||
print "strftime test for", time.ctime(now)
|
||||
print("strftime test for", time.ctime(now))
|
||||
nowsecs = str(int(now))[:-1]
|
||||
gmt = time.gmtime(now)
|
||||
now = time.localtime(now)
|
||||
|
@ -113,42 +113,42 @@ def strftest(now):
|
|||
)
|
||||
|
||||
if verbose:
|
||||
print "Strftime test, platform: %s, Python version: %s" % \
|
||||
(sys.platform, sys.version.split()[0])
|
||||
print("Strftime test, platform: %s, Python version: %s" % \
|
||||
(sys.platform, sys.version.split()[0]))
|
||||
|
||||
for e in expectations:
|
||||
try:
|
||||
result = time.strftime(e[0], now)
|
||||
except ValueError as error:
|
||||
print "Standard '%s' format gave error:" % e[0], error
|
||||
print("Standard '%s' format gave error:" % e[0], error)
|
||||
continue
|
||||
if re.match(escapestr(e[1], ampm), result): continue
|
||||
if not result or result[0] == '%':
|
||||
print "Does not support standard '%s' format (%s)" % (e[0], e[2])
|
||||
print("Does not support standard '%s' format (%s)" % (e[0], e[2]))
|
||||
else:
|
||||
print "Conflict for %s (%s):" % (e[0], e[2])
|
||||
print " Expected %s, but got %s" % (e[1], result)
|
||||
print("Conflict for %s (%s):" % (e[0], e[2]))
|
||||
print(" Expected %s, but got %s" % (e[1], result))
|
||||
|
||||
for e in nonstandard_expectations:
|
||||
try:
|
||||
result = time.strftime(e[0], now)
|
||||
except ValueError as result:
|
||||
if verbose:
|
||||
print "Error for nonstandard '%s' format (%s): %s" % \
|
||||
(e[0], e[2], str(result))
|
||||
print("Error for nonstandard '%s' format (%s): %s" % \
|
||||
(e[0], e[2], str(result)))
|
||||
continue
|
||||
if re.match(escapestr(e[1], ampm), result):
|
||||
if verbose:
|
||||
print "Supports nonstandard '%s' format (%s)" % (e[0], e[2])
|
||||
print("Supports nonstandard '%s' format (%s)" % (e[0], e[2]))
|
||||
elif not result or result[0] == '%':
|
||||
if verbose:
|
||||
print "Does not appear to support '%s' format (%s)" % (e[0],
|
||||
e[2])
|
||||
print("Does not appear to support '%s' format (%s)" % (e[0],
|
||||
e[2]))
|
||||
else:
|
||||
if verbose:
|
||||
print "Conflict for nonstandard '%s' format (%s):" % (e[0],
|
||||
e[2])
|
||||
print " Expected %s, but got %s" % (e[1], result)
|
||||
print("Conflict for nonstandard '%s' format (%s):" % (e[0],
|
||||
e[2]))
|
||||
print(" Expected %s, but got %s" % (e[1], result))
|
||||
|
||||
def fixasctime(s):
|
||||
if s[8] == ' ':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue