mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Use the preferred form of raise statements in the docs.
This commit is contained in:
parent
dad7b7b1cb
commit
c1edec3374
12 changed files with 26 additions and 27 deletions
|
@ -37,7 +37,7 @@ Usage: %prog [options] msgfile
|
|||
os.mkdir(opts.directory)
|
||||
except OSError, e:
|
||||
# Ignore directory exists error
|
||||
if e.errno <> errno.EEXIST:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
fp = open(msgfile)
|
||||
|
|
|
@ -149,21 +149,21 @@ def test():
|
|||
except ZeroDivisionError:
|
||||
print '\tGot ZeroDivisionError as expected from pool.apply()'
|
||||
else:
|
||||
raise AssertionError, 'expected ZeroDivisionError'
|
||||
raise AssertionError('expected ZeroDivisionError')
|
||||
|
||||
try:
|
||||
print pool.map(f, range(10))
|
||||
except ZeroDivisionError:
|
||||
print '\tGot ZeroDivisionError as expected from pool.map()'
|
||||
else:
|
||||
raise AssertionError, 'expected ZeroDivisionError'
|
||||
raise AssertionError('expected ZeroDivisionError')
|
||||
|
||||
try:
|
||||
print list(pool.imap(f, range(10)))
|
||||
except ZeroDivisionError:
|
||||
print '\tGot ZeroDivisionError as expected from list(pool.imap())'
|
||||
else:
|
||||
raise AssertionError, 'expected ZeroDivisionError'
|
||||
raise AssertionError('expected ZeroDivisionError')
|
||||
|
||||
it = pool.imap(f, range(10))
|
||||
for i in range(10):
|
||||
|
@ -176,7 +176,7 @@ def test():
|
|||
break
|
||||
else:
|
||||
if i == 5:
|
||||
raise AssertionError, 'expected ZeroDivisionError'
|
||||
raise AssertionError('expected ZeroDivisionError')
|
||||
|
||||
assert i == 9
|
||||
print '\tGot ZeroDivisionError as expected from IMapIterator.next()'
|
||||
|
|
|
@ -249,7 +249,7 @@ def test(namespace=multiprocessing):
|
|||
info = multiprocessing._debug_info()
|
||||
if info:
|
||||
print info
|
||||
raise ValueError, 'there should be no positive refcounts left'
|
||||
raise ValueError('there should be no positive refcounts left')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -271,6 +271,6 @@ if __name__ == '__main__':
|
|||
import multiprocessing.dummy as namespace
|
||||
else:
|
||||
print 'Usage:\n\t%s [processes | manager | threads]' % sys.argv[0]
|
||||
raise SystemExit, 2
|
||||
raise SystemExit(2)
|
||||
|
||||
test(namespace)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue