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:
Guido van Rossum 2007-02-09 05:37:30 +00:00
parent 452bf519a7
commit be19ed77dd
331 changed files with 2567 additions and 2648 deletions

View file

@ -65,63 +65,63 @@ testmeths = [
class AllTests:
def __hash__(self, *args):
print "__hash__:", args
print("__hash__:", args)
return hash(id(self))
def __str__(self, *args):
print "__str__:", args
print("__str__:", args)
return "AllTests"
def __repr__(self, *args):
print "__repr__:", args
print("__repr__:", args)
return "AllTests"
def __int__(self, *args):
print "__int__:", args
print("__int__:", args)
return 1
def __float__(self, *args):
print "__float__:", args
print("__float__:", args)
return 1.0
def __oct__(self, *args):
print "__oct__:", args
print("__oct__:", args)
return '01'
def __hex__(self, *args):
print "__hex__:", args
print("__hex__:", args)
return '0x1'
def __cmp__(self, *args):
print "__cmp__:", args
print("__cmp__:", args)
return 0
def __eq__(self, *args):
print "__eq__:", args
print("__eq__:", args)
return True
def __ne__(self, *args):
print "__ne__:", args
print("__ne__:", args)
return False
def __lt__(self, *args):
print "__lt__:", args
print("__lt__:", args)
return False
def __le__(self, *args):
print "__le__:", args
print("__le__:", args)
return True
def __gt__(self, *args):
print "__gt__:", args
print("__gt__:", args)
return False
def __ge__(self, *args):
print "__ge__:", args
print("__ge__:", args)
return True
def __del__(self, *args):
print "__del__:", args
print("__del__:", args)
# Synthesize AllTests methods from the names in testmeths.
@ -186,7 +186,7 @@ class Empty: pass
try:
1 in Empty()
print 'failed, should have raised TypeError'
print('failed, should have raised TypeError')
except TypeError:
pass
@ -224,9 +224,9 @@ if sys.platform[:4] != 'java':
else:
# This works under Jython, but the actual slice values are
# different.
print "__getitem__: (slice(0, 42, None),)"
print "__setitem__: (slice(0, 42, None), 'The Answer')"
print "__delitem__: (slice(0, 42, None),)"
print("__getitem__: (slice(0, 42, None),)")
print("__setitem__: (slice(0, 42, None), 'The Answer')")
print("__delitem__: (slice(0, 42, None),)")
# Unary operations
@ -265,14 +265,14 @@ if sys.platform[:4] == 'java':
class ExtraTests:
def __getattr__(self, *args):
print "__getattr__:", args
print("__getattr__:", args)
return "SomeVal"
def __setattr__(self, *args):
print "__setattr__:", args
print("__setattr__:", args)
def __delattr__(self, *args):
print "__delattr__:", args
print("__delattr__:", args)
testme = ExtraTests()
testme.spam
@ -349,7 +349,7 @@ try:
A().a # Raised AttributeError: A instance has no attribute 'a'
except AttributeError as x:
if str(x) != "booh":
print "attribute error for A().a got masked:", str(x)
print("attribute error for A().a got masked:", str(x))
class E:
__eq__ = property(booh)
@ -362,7 +362,7 @@ try:
except AttributeError as x:
pass
else:
print "attribute error for I.__init__ got masked"
print("attribute error for I.__init__ got masked")
# Test comparison and hash of methods