mirror of
https://github.com/python/cpython.git
synced 2025-10-18 04:38:07 +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
|
@ -52,22 +52,22 @@ else:
|
|||
|
||||
def expect(got_this, expect_this):
|
||||
if test_support.verbose:
|
||||
print '%r =?= %r ...' % (got_this, expect_this),
|
||||
print('%r =?= %r ...' % (got_this, expect_this), end=' ')
|
||||
if got_this != expect_this:
|
||||
if test_support.verbose:
|
||||
print 'no'
|
||||
print('no')
|
||||
raise test_support.TestFailed, 'got %r, but expected %r' %\
|
||||
(got_this, expect_this)
|
||||
else:
|
||||
if test_support.verbose:
|
||||
print 'yes'
|
||||
print('yes')
|
||||
|
||||
|
||||
# test that each file function works as expected for a large (i.e. >2GB, do
|
||||
# we have to check >4GB) files
|
||||
|
||||
if test_support.verbose:
|
||||
print 'create large file via seek (may be sparse file) ...'
|
||||
print('create large file via seek (may be sparse file) ...')
|
||||
f = open(name, 'wb')
|
||||
try:
|
||||
f.write('z')
|
||||
|
@ -76,16 +76,16 @@ try:
|
|||
f.write('a')
|
||||
f.flush()
|
||||
if test_support.verbose:
|
||||
print 'check file size with os.fstat'
|
||||
print('check file size with os.fstat')
|
||||
expect(os.fstat(f.fileno())[stat.ST_SIZE], size+1)
|
||||
finally:
|
||||
f.close()
|
||||
if test_support.verbose:
|
||||
print 'check file size with os.stat'
|
||||
print('check file size with os.stat')
|
||||
expect(os.stat(name)[stat.ST_SIZE], size+1)
|
||||
|
||||
if test_support.verbose:
|
||||
print 'play around with seek() and read() with the built largefile'
|
||||
print('play around with seek() and read() with the built largefile')
|
||||
f = open(name, 'rb')
|
||||
try:
|
||||
expect(f.tell(), 0)
|
||||
|
@ -119,7 +119,7 @@ finally:
|
|||
f.close()
|
||||
|
||||
if test_support.verbose:
|
||||
print 'play around with os.lseek() with the built largefile'
|
||||
print('play around with os.lseek() with the built largefile')
|
||||
f = open(name, 'rb')
|
||||
try:
|
||||
expect(os.lseek(f.fileno(), 0, 0), 0)
|
||||
|
@ -136,7 +136,7 @@ finally:
|
|||
|
||||
if hasattr(f, 'truncate'):
|
||||
if test_support.verbose:
|
||||
print 'try truncate'
|
||||
print('try truncate')
|
||||
f = open(name, 'r+b')
|
||||
try:
|
||||
f.seek(0, 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue