Added test cases for extended printing to an instance. This picked up

a bug in JPython where the instance had to have a flush() method.
This commit is contained in:
Barry Warsaw 2000-10-11 21:26:03 +00:00
parent 6fe9bacb8c
commit 7e3e1c1ece
1 changed files with 9 additions and 1 deletions

View File

@ -268,10 +268,18 @@ print >> sys.stdout
print >> sys.stdout, 0 or 1, 0 or 1, print >> sys.stdout, 0 or 1, 0 or 1,
print >> sys.stdout, 0 or 1 print >> sys.stdout, 0 or 1
# test print >> None # test printing to an instance
class Gulp: class Gulp:
def write(self, msg): pass def write(self, msg): pass
gulp = Gulp()
print >> gulp, 1, 2, 3
print >> gulp, 1, 2, 3,
print >> gulp
print >> gulp, 0 or 1, 0 or 1,
print >> gulp, 0 or 1
# test print >> None
def driver(): def driver():
oldstdout = sys.stdout oldstdout = sys.stdout
sys.stdout = Gulp() sys.stdout = Gulp()