mirror of
https://github.com/python/cpython.git
synced 2025-08-28 12:45:07 +00:00
Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent". Use "is" and "is not" when comparing with None or type objects.
This commit is contained in:
parent
63596aeb33
commit
132dce2246
55 changed files with 520 additions and 519 deletions
|
@ -9,7 +9,7 @@ def test(name, input, output, *args):
|
|||
val = apply(f, params)
|
||||
except:
|
||||
val = sys.exc_type
|
||||
if val <> output:
|
||||
if val != output:
|
||||
print '%s%s = %s: %s expected' % (f.__name__, params, `val`, `output`)
|
||||
|
||||
test('abs', -1, 1)
|
||||
|
@ -21,12 +21,12 @@ test('countOf', [1, 2, 1, 3, 1, 4], 1, 3)
|
|||
|
||||
a = [4, 3, 2, 1]
|
||||
test('delitem', a, None, 1)
|
||||
if a <> [4, 2, 1]:
|
||||
if a != [4, 2, 1]:
|
||||
print 'delitem() failed'
|
||||
|
||||
a = range(10)
|
||||
test('delslice', a, None, 2, 8)
|
||||
if a <> [0, 1, 8, 9]:
|
||||
if a != [0, 1, 8, 9]:
|
||||
print 'delslice() failed'
|
||||
|
||||
a = range(10)
|
||||
|
@ -59,12 +59,12 @@ test('sequenceIncludes', range(4), 1, 2)
|
|||
test('sequenceIncludes', range(4), 0, 5)
|
||||
|
||||
test('setitem', a, None, 0, 2)
|
||||
if a <> [2, 1, 2]:
|
||||
if a != [2, 1, 2]:
|
||||
print 'setitem() failed'
|
||||
|
||||
a = range(4)
|
||||
test('setslice', a, None, 1, 3, [2, 1])
|
||||
if a <> [0, 2, 1, 3]:
|
||||
if a != [0, 2, 1, 3]:
|
||||
print 'setslice() failed:', a
|
||||
|
||||
test('sub', 5, 2, 3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue