[Python-checkins] CVS: python/dist/src/Lib/test regrtest.py,1.27,1.28 test_audioop.py,1.6,1.7 test_b1.py,1.27,1.28 test_b2.py,1.20,1.21 test_binascii.py,1.6,1.7 test_binhex.py,1.6,1.7 test_bsddb.py,1.4,1.5 test_grammar.py,1.20,1.21 test_math.py,1.9,1.10 test_md5.py,1.3,1.4 test_mmap.py,1.11,1.12 test_new.py,1.5,1.6 test_nis.py,1.8,1.9 test_opcodes.py,1.8,1.9 test_operator.py,1.3,1.4 test_pow.py,1.6,1.7 test_pty.py,1.6,1.7 test_pwd.py,1.7,1.8 test_re.py,1.26,1.27 test_rotor.py,1.4,1.5 test_sax.py,1.13,1.14 test_socket.py,1.14,1.15 test_sre.py,1.13,1.14 test_struct.py,1.6,1.7 test_support.py,1.8,1.9 test_time.py,1.5,1.6 test_types.py,1.18,1.19 test_unpack.py,1.4,1.5
Fred L. Drake
python-dev@python.org
Tue, 12 Dec 2000 15:11:45 -0800
- Previous message: [Python-checkins] CVS: python/dist/src/Lib/plat-irix6 FL.py,1.1,1.2 cdplayer.py,1.3,1.4 flp.py,1.6,1.7 jpeg.py,1.3,1.4 panel.py,1.2,1.3 panelparser.py,1.1,1.2 readcd.py,1.2,1.3 torgb.py,1.2,1.3
- Next message: [Python-checkins] CVS: python/dist/src/Lib StringIO.py,1.12,1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Lib/test
In directory slayer.i.sourceforge.net:/tmp/cvs-serv18670/test
Modified Files:
regrtest.py test_audioop.py test_b1.py test_b2.py
test_binascii.py test_binhex.py test_bsddb.py test_grammar.py
test_math.py test_md5.py test_mmap.py test_new.py test_nis.py
test_opcodes.py test_operator.py test_pow.py test_pty.py
test_pwd.py test_re.py test_rotor.py test_sax.py
test_socket.py test_sre.py test_struct.py test_support.py
test_time.py test_types.py test_unpack.py
Log Message:
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.
Index: regrtest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** regrtest.py 2000/10/23 17:22:07 1.27
--- regrtest.py 2000/12/12 23:11:42 1.28
***************
*** 284,288 ****
def write(self, data):
expected = self.fp.read(len(data))
! if data <> expected:
raise test_support.TestFailed, \
'Writing: '+`data`+', expected: '+`expected`
--- 284,288 ----
def write(self, data):
expected = self.fp.read(len(data))
! if data != expected:
raise test_support.TestFailed, \
'Writing: '+`data`+', expected: '+`expected`
Index: test_audioop.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_audioop.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** test_audioop.py 1998/03/26 19:41:42 1.6
--- test_audioop.py 2000/12/12 23:11:42 1.7
***************
*** 25,31 ****
if verbose:
print 'max'
! if audioop.max(data[0], 1) <> 2 or \
! audioop.max(data[1], 2) <> 2 or \
! audioop.max(data[2], 4) <> 2:
return 0
return 1
--- 25,31 ----
if verbose:
print 'max'
! if audioop.max(data[0], 1) != 2 or \
! audioop.max(data[1], 2) != 2 or \
! audioop.max(data[2], 4) != 2:
return 0
return 1
***************
*** 34,40 ****
if verbose:
print 'minmax'
! if audioop.minmax(data[0], 1) <> (0, 2) or \
! audioop.minmax(data[1], 2) <> (0, 2) or \
! audioop.minmax(data[2], 4) <> (0, 2):
return 0
return 1
--- 34,40 ----
if verbose:
print 'minmax'
! if audioop.minmax(data[0], 1) != (0, 2) or \
! audioop.minmax(data[1], 2) != (0, 2) or \
! audioop.minmax(data[2], 4) != (0, 2):
return 0
return 1
***************
*** 43,49 ****
if verbose:
print 'maxpp'
! if audioop.maxpp(data[0], 1) <> 0 or \
! audioop.maxpp(data[1], 2) <> 0 or \
! audioop.maxpp(data[2], 4) <> 0:
return 0
return 1
--- 43,49 ----
if verbose:
print 'maxpp'
! if audioop.maxpp(data[0], 1) != 0 or \
! audioop.maxpp(data[1], 2) != 0 or \
! audioop.maxpp(data[2], 4) != 0:
return 0
return 1
***************
*** 52,58 ****
if verbose:
print 'avg'
! if audioop.avg(data[0], 1) <> 1 or \
! audioop.avg(data[1], 2) <> 1 or \
! audioop.avg(data[2], 4) <> 1:
return 0
return 1
--- 52,58 ----
if verbose:
print 'avg'
! if audioop.avg(data[0], 1) != 1 or \
! audioop.avg(data[1], 2) != 1 or \
! audioop.avg(data[2], 4) != 1:
return 0
return 1
***************
*** 61,74 ****
if verbose:
print 'avgpp'
! if audioop.avgpp(data[0], 1) <> 0 or \
! audioop.avgpp(data[1], 2) <> 0 or \
! audioop.avgpp(data[2], 4) <> 0:
return 0
return 1
def testrms(data):
! if audioop.rms(data[0], 1) <> 1 or \
! audioop.rms(data[1], 2) <> 1 or \
! audioop.rms(data[2], 4) <> 1:
return 0
return 1
--- 61,74 ----
if verbose:
print 'avgpp'
! if audioop.avgpp(data[0], 1) != 0 or \
! audioop.avgpp(data[1], 2) != 0 or \
! audioop.avgpp(data[2], 4) != 0:
return 0
return 1
def testrms(data):
! if audioop.rms(data[0], 1) != 1 or \
! audioop.rms(data[1], 2) != 1 or \
! audioop.rms(data[2], 4) != 1:
return 0
return 1
***************
*** 77,83 ****
if verbose:
print 'cross'
! if audioop.cross(data[0], 1) <> 0 or \
! audioop.cross(data[1], 2) <> 0 or \
! audioop.cross(data[2], 4) <> 0:
return 0
return 1
--- 77,83 ----
if verbose:
print 'cross'
! if audioop.cross(data[0], 1) != 0 or \
! audioop.cross(data[1], 2) != 0 or \
! audioop.cross(data[2], 4) != 0:
return 0
return 1
***************
*** 92,98 ****
str = str + chr(ord(s)*2)
data2.append(str)
! if audioop.add(data[0], data[0], 1) <> data2[0] or \
! audioop.add(data[1], data[1], 2) <> data2[1] or \
! audioop.add(data[2], data[2], 4) <> data2[2]:
return 0
return 1
--- 92,98 ----
str = str + chr(ord(s)*2)
data2.append(str)
! if audioop.add(data[0], data[0], 1) != data2[0] or \
! audioop.add(data[1], data[1], 2) != data2[1] or \
! audioop.add(data[2], data[2], 4) != data2[2]:
return 0
return 1
***************
*** 105,111 ****
d2 = audioop.bias(data[1], 2, 100)
d4 = audioop.bias(data[2], 4, 100)
! if audioop.avg(d1, 1) <> 101 or \
! audioop.avg(d2, 2) <> 101 or \
! audioop.avg(d4, 4) <> 101:
return 0
return 1
--- 105,111 ----
d2 = audioop.bias(data[1], 2, 100)
d4 = audioop.bias(data[2], 4, 100)
! if audioop.avg(d1, 1) != 101 or \
! audioop.avg(d2, 2) != 101 or \
! audioop.avg(d4, 4) != 101:
return 0
return 1
***************
*** 119,123 ****
got = len(d1)/3
wtd = len(d2)/3
! if len(audioop.lin2lin(d1, got, wtd)) <> len(d2):
return 0
return 1
--- 119,123 ----
got = len(d1)/3
wtd = len(d2)/3
! if len(audioop.lin2lin(d1, got, wtd)) != len(d2):
return 0
return 1
***************
*** 125,129 ****
def testadpcm2lin(data):
# Very cursory test
! if audioop.adpcm2lin('\0\0', 1, None) <> ('\0\0\0\0', (0,0)):
return 0
return 1
--- 125,129 ----
def testadpcm2lin(data):
# Very cursory test
! if audioop.adpcm2lin('\0\0', 1, None) != ('\0\0\0\0', (0,0)):
return 0
return 1
***************
*** 133,137 ****
print 'lin2adpcm'
# Very cursory test
! if audioop.lin2adpcm('\0\0\0\0', 1, None) <> ('\0\0', (0,0)):
return 0
return 1
--- 133,137 ----
print 'lin2adpcm'
# Very cursory test
! if audioop.lin2adpcm('\0\0\0\0', 1, None) != ('\0\0', (0,0)):
return 0
return 1
***************
*** 140,146 ****
if verbose:
print 'lin2ulaw'
! if audioop.lin2ulaw(data[0], 1) <> '\377\347\333' or \
! audioop.lin2ulaw(data[1], 2) <> '\377\377\377' or \
! audioop.lin2ulaw(data[2], 4) <> '\377\377\377':
return 0
return 1
--- 140,146 ----
if verbose:
print 'lin2ulaw'
! if audioop.lin2ulaw(data[0], 1) != '\377\347\333' or \
! audioop.lin2ulaw(data[1], 2) != '\377\377\377' or \
! audioop.lin2ulaw(data[2], 4) != '\377\377\377':
return 0
return 1
***************
*** 151,155 ****
# Cursory
d = audioop.lin2ulaw(data[0], 1)
! if audioop.ulaw2lin(d, 1) <> data[0]:
return 0
return 1
--- 151,155 ----
# Cursory
d = audioop.lin2ulaw(data[0], 1)
! if audioop.ulaw2lin(d, 1) != data[0]:
return 0
return 1
***************
*** 164,170 ****
str = str + chr(ord(s)*2)
data2.append(str)
! if audioop.mul(data[0], 1, 2) <> data2[0] or \
! audioop.mul(data[1],2, 2) <> data2[1] or \
! audioop.mul(data[2], 4, 2) <> data2[2]:
return 0
return 1
--- 164,170 ----
str = str + chr(ord(s)*2)
data2.append(str)
! if audioop.mul(data[0], 1, 2) != data2[0] or \
! audioop.mul(data[1],2, 2) != data2[1] or \
! audioop.mul(data[2], 4, 2) != data2[2]:
return 0
return 1
***************
*** 183,187 ****
if verbose:
print 'reverse'
! if audioop.reverse(data[0], 1) <> '\2\1\0':
return 0
return 1
--- 183,187 ----
if verbose:
print 'reverse'
! if audioop.reverse(data[0], 1) != '\2\1\0':
return 0
return 1
***************
*** 193,197 ****
for d in data[0]:
data2 = data2 + d + d
! if audioop.tomono(data2, 1, 0.5, 0.5) <> data[0]:
return 0
return 1
--- 193,197 ----
for d in data[0]:
data2 = data2 + d + d
! if audioop.tomono(data2, 1, 0.5, 0.5) != data[0]:
return 0
return 1
***************
*** 203,207 ****
for d in data[0]:
data2 = data2 + d + d
! if audioop.tostereo(data[0], 1, 1, 1) <> data2:
return 0
return 1
--- 203,207 ----
for d in data[0]:
data2 = data2 + d + d
! if audioop.tostereo(data[0], 1, 1, 1) != data2:
return 0
return 1
***************
*** 210,214 ****
if verbose:
print 'findfactor'
! if audioop.findfactor(data[1], data[1]) <> 1.0:
return 0
return 1
--- 210,214 ----
if verbose:
print 'findfactor'
! if audioop.findfactor(data[1], data[1]) != 1.0:
return 0
return 1
***************
*** 217,221 ****
if verbose:
print 'findfit'
! if audioop.findfit(data[1], data[1]) <> (0, 1.0):
return 0
return 1
--- 217,221 ----
if verbose:
print 'findfit'
! if audioop.findfit(data[1], data[1]) != (0, 1.0):
return 0
return 1
***************
*** 224,228 ****
if verbose:
print 'findmax'
! if audioop.findmax(data[1], 1) <> 2:
return 0
return 1
--- 224,228 ----
if verbose:
print 'findmax'
! if audioop.findmax(data[1], 1) != 2:
return 0
return 1
***************
*** 232,238 ****
print 'getsample'
for i in range(3):
! if audioop.getsample(data[0], 1, i) <> i or \
! audioop.getsample(data[1], 2, i) <> i or \
! audioop.getsample(data[2], 4, i) <> i:
return 0
return 1
--- 232,238 ----
print 'getsample'
for i in range(3):
! if audioop.getsample(data[0], 1, i) != i or \
! audioop.getsample(data[1], 2, i) != i or \
! audioop.getsample(data[2], 4, i) != i:
return 0
return 1
Index: test_b1.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** test_b1.py 2000/09/19 20:58:53 1.27
--- test_b1.py 2000/12/12 23:11:42 1.28
***************
*** 12,26 ****
print 'abs'
! if abs(0) <> 0: raise TestFailed, 'abs(0)'
! if abs(1234) <> 1234: raise TestFailed, 'abs(1234)'
! if abs(-1234) <> 1234: raise TestFailed, 'abs(-1234)'
#
! if abs(0.0) <> 0.0: raise TestFailed, 'abs(0.0)'
! if abs(3.14) <> 3.14: raise TestFailed, 'abs(3.14)'
! if abs(-3.14) <> 3.14: raise TestFailed, 'abs(-3.14)'
#
! if abs(0L) <> 0L: raise TestFailed, 'abs(0L)'
! if abs(1234L) <> 1234L: raise TestFailed, 'abs(1234L)'
! if abs(-1234L) <> 1234L: raise TestFailed, 'abs(-1234L)'
print 'apply'
--- 12,26 ----
print 'abs'
! if abs(0) != 0: raise TestFailed, 'abs(0)'
! if abs(1234) != 1234: raise TestFailed, 'abs(1234)'
! if abs(-1234) != 1234: raise TestFailed, 'abs(-1234)'
#
! if abs(0.0) != 0.0: raise TestFailed, 'abs(0.0)'
! if abs(3.14) != 3.14: raise TestFailed, 'abs(3.14)'
! if abs(-3.14) != 3.14: raise TestFailed, 'abs(-3.14)'
#
! if abs(0L) != 0L: raise TestFailed, 'abs(0L)'
! if abs(1234L) != 1234L: raise TestFailed, 'abs(1234L)'
! if abs(-1234L) != 1234L: raise TestFailed, 'abs(-1234L)'
print 'apply'
***************
*** 56,67 ****
print 'chr'
! if chr(32) <> ' ': raise TestFailed, 'chr(32)'
! if chr(65) <> 'A': raise TestFailed, 'chr(65)'
! if chr(97) <> 'a': raise TestFailed, 'chr(97)'
print 'cmp'
! if cmp(-1, 1) <> -1: raise TestFailed, 'cmp(-1, 1)'
! if cmp(1, -1) <> 1: raise TestFailed, 'cmp(1, -1)'
! if cmp(1, 1) <> 0: raise TestFailed, 'cmp(1, 1)'
# verify that circular objects are handled
a = []; a.append(a)
--- 56,67 ----
print 'chr'
! if chr(32) != ' ': raise TestFailed, 'chr(32)'
! if chr(65) != 'A': raise TestFailed, 'chr(65)'
! if chr(97) != 'a': raise TestFailed, 'chr(97)'
print 'cmp'
! if cmp(-1, 1) != -1: raise TestFailed, 'cmp(-1, 1)'
! if cmp(1, -1) != 1: raise TestFailed, 'cmp(1, -1)'
! if cmp(1, 1) != 0: raise TestFailed, 'cmp(1, 1)'
# verify that circular objects are handled
a = []; a.append(a)
***************
*** 78,82 ****
print 'coerce'
if fcmp(coerce(1, 1.1), (1.0, 1.1)): raise TestFailed, 'coerce(1, 1.1)'
! if coerce(1, 1L) <> (1L, 1L): raise TestFailed, 'coerce(1, 1L)'
if fcmp(coerce(1L, 1.1), (1.0, 1.1)): raise TestFailed, 'coerce(1L, 1.1)'
--- 78,82 ----
print 'coerce'
if fcmp(coerce(1, 1.1), (1.0, 1.1)): raise TestFailed, 'coerce(1, 1.1)'
! if coerce(1, 1L) != (1L, 1L): raise TestFailed, 'coerce(1, 1L)'
if fcmp(coerce(1L, 1.1), (1.0, 1.1)): raise TestFailed, 'coerce(1L, 1.1)'
***************
*** 85,115 ****
print 'complex'
! if complex(1,10) <> 1+10j: raise TestFailed, 'complex(1,10)'
! if complex(1,10L) <> 1+10j: raise TestFailed, 'complex(1,10L)'
! if complex(1,10.0) <> 1+10j: raise TestFailed, 'complex(1,10.0)'
! if complex(1L,10) <> 1+10j: raise TestFailed, 'complex(1L,10)'
! if complex(1L,10L) <> 1+10j: raise TestFailed, 'complex(1L,10L)'
! if complex(1L,10.0) <> 1+10j: raise TestFailed, 'complex(1L,10.0)'
! if complex(1.0,10) <> 1+10j: raise TestFailed, 'complex(1.0,10)'
! if complex(1.0,10L) <> 1+10j: raise TestFailed, 'complex(1.0,10L)'
! if complex(1.0,10.0) <> 1+10j: raise TestFailed, 'complex(1.0,10.0)'
! if complex(3.14+0j) <> 3.14+0j: raise TestFailed, 'complex(3.14)'
! if complex(3.14) <> 3.14+0j: raise TestFailed, 'complex(3.14)'
! if complex(314) <> 314.0+0j: raise TestFailed, 'complex(314)'
! if complex(314L) <> 314.0+0j: raise TestFailed, 'complex(314L)'
! if complex(3.14+0j, 0j) <> 3.14+0j: raise TestFailed, 'complex(3.14, 0j)'
! if complex(3.14, 0.0) <> 3.14+0j: raise TestFailed, 'complex(3.14, 0.0)'
! if complex(314, 0) <> 314.0+0j: raise TestFailed, 'complex(314, 0)'
! if complex(314L, 0L) <> 314.0+0j: raise TestFailed, 'complex(314L, 0L)'
! if complex(0j, 3.14j) <> -3.14+0j: raise TestFailed, 'complex(0j, 3.14j)'
! if complex(0.0, 3.14j) <> -3.14+0j: raise TestFailed, 'complex(0.0, 3.14j)'
! if complex(0j, 3.14) <> 3.14j: raise TestFailed, 'complex(0j, 3.14)'
! if complex(0.0, 3.14) <> 3.14j: raise TestFailed, 'complex(0.0, 3.14)'
! if complex(" 3.14+J ") <> 3.14+1j: raise TestFailed, 'complex(" 3.14+J )"'
! if complex(u" 3.14+J ") <> 3.14+1j: raise TestFailed, 'complex(u" 3.14+J )"'
class Z:
def __complex__(self): return 3.14j
z = Z()
! if complex(z) <> 3.14j: raise TestFailed, 'complex(classinstance)'
print 'delattr'
--- 85,115 ----
print 'complex'
! if complex(1,10) != 1+10j: raise TestFailed, 'complex(1,10)'
! if complex(1,10L) != 1+10j: raise TestFailed, 'complex(1,10L)'
! if complex(1,10.0) != 1+10j: raise TestFailed, 'complex(1,10.0)'
! if complex(1L,10) != 1+10j: raise TestFailed, 'complex(1L,10)'
! if complex(1L,10L) != 1+10j: raise TestFailed, 'complex(1L,10L)'
! if complex(1L,10.0) != 1+10j: raise TestFailed, 'complex(1L,10.0)'
! if complex(1.0,10) != 1+10j: raise TestFailed, 'complex(1.0,10)'
! if complex(1.0,10L) != 1+10j: raise TestFailed, 'complex(1.0,10L)'
! if complex(1.0,10.0) != 1+10j: raise TestFailed, 'complex(1.0,10.0)'
! if complex(3.14+0j) != 3.14+0j: raise TestFailed, 'complex(3.14)'
! if complex(3.14) != 3.14+0j: raise TestFailed, 'complex(3.14)'
! if complex(314) != 314.0+0j: raise TestFailed, 'complex(314)'
! if complex(314L) != 314.0+0j: raise TestFailed, 'complex(314L)'
! if complex(3.14+0j, 0j) != 3.14+0j: raise TestFailed, 'complex(3.14, 0j)'
! if complex(3.14, 0.0) != 3.14+0j: raise TestFailed, 'complex(3.14, 0.0)'
! if complex(314, 0) != 314.0+0j: raise TestFailed, 'complex(314, 0)'
! if complex(314L, 0L) != 314.0+0j: raise TestFailed, 'complex(314L, 0L)'
! if complex(0j, 3.14j) != -3.14+0j: raise TestFailed, 'complex(0j, 3.14j)'
! if complex(0.0, 3.14j) != -3.14+0j: raise TestFailed, 'complex(0.0, 3.14j)'
! if complex(0j, 3.14) != 3.14j: raise TestFailed, 'complex(0j, 3.14)'
! if complex(0.0, 3.14) != 3.14j: raise TestFailed, 'complex(0.0, 3.14)'
! if complex(" 3.14+J ") != 3.14+1j: raise TestFailed, 'complex(" 3.14+J )"'
! if complex(u" 3.14+J ") != 3.14+1j: raise TestFailed, 'complex(u" 3.14+J )"'
class Z:
def __complex__(self): return 3.14j
z = Z()
! if complex(z) != 3.14j: raise TestFailed, 'complex(classinstance)'
print 'delattr'
***************
*** 125,142 ****
print 'divmod'
! if divmod(12, 7) <> (1, 5): raise TestFailed, 'divmod(12, 7)'
! if divmod(-12, 7) <> (-2, 2): raise TestFailed, 'divmod(-12, 7)'
! if divmod(12, -7) <> (-2, -2): raise TestFailed, 'divmod(12, -7)'
! if divmod(-12, -7) <> (1, -5): raise TestFailed, 'divmod(-12, -7)'
#
! if divmod(12L, 7L) <> (1L, 5L): raise TestFailed, 'divmod(12L, 7L)'
! if divmod(-12L, 7L) <> (-2L, 2L): raise TestFailed, 'divmod(-12L, 7L)'
! if divmod(12L, -7L) <> (-2L, -2L): raise TestFailed, 'divmod(12L, -7L)'
! if divmod(-12L, -7L) <> (1L, -5L): raise TestFailed, 'divmod(-12L, -7L)'
#
! if divmod(12, 7L) <> (1, 5L): raise TestFailed, 'divmod(12, 7L)'
! if divmod(-12, 7L) <> (-2, 2L): raise TestFailed, 'divmod(-12, 7L)'
! if divmod(12L, -7) <> (-2L, -2): raise TestFailed, 'divmod(12L, -7)'
! if divmod(-12L, -7) <> (1L, -5): raise TestFailed, 'divmod(-12L, -7)'
#
if fcmp(divmod(3.25, 1.0), (3.0, 0.25)):
--- 125,142 ----
print 'divmod'
! if divmod(12, 7) != (1, 5): raise TestFailed, 'divmod(12, 7)'
! if divmod(-12, 7) != (-2, 2): raise TestFailed, 'divmod(-12, 7)'
! if divmod(12, -7) != (-2, -2): raise TestFailed, 'divmod(12, -7)'
! if divmod(-12, -7) != (1, -5): raise TestFailed, 'divmod(-12, -7)'
#
! if divmod(12L, 7L) != (1L, 5L): raise TestFailed, 'divmod(12L, 7L)'
! if divmod(-12L, 7L) != (-2L, 2L): raise TestFailed, 'divmod(-12L, 7L)'
! if divmod(12L, -7L) != (-2L, -2L): raise TestFailed, 'divmod(12L, -7L)'
! if divmod(-12L, -7L) != (1L, -5L): raise TestFailed, 'divmod(-12L, -7L)'
#
! if divmod(12, 7L) != (1, 5L): raise TestFailed, 'divmod(12, 7L)'
! if divmod(-12, 7L) != (-2, 2L): raise TestFailed, 'divmod(-12, 7L)'
! if divmod(12L, -7) != (-2L, -2): raise TestFailed, 'divmod(12L, -7)'
! if divmod(-12L, -7) != (1L, -5): raise TestFailed, 'divmod(-12L, -7)'
#
if fcmp(divmod(3.25, 1.0), (3.0, 0.25)):
***************
*** 150,176 ****
print 'eval'
! if eval('1+1') <> 2: raise TestFailed, 'eval(\'1+1\')'
! if eval(' 1+1\n') <> 2: raise TestFailed, 'eval(\' 1+1\\n\')'
globals = {'a': 1, 'b': 2}
locals = {'b': 200, 'c': 300}
! if eval('a', globals) <> 1:
raise TestFailed, "eval(1) == %s" % eval('a', globals)
! if eval('a', globals, locals) <> 1:
raise TestFailed, "eval(2)"
! if eval('b', globals, locals) <> 200:
raise TestFailed, "eval(3)"
! if eval('c', globals, locals) <> 300:
raise TestFailed, "eval(4)"
! if eval(u'1+1') <> 2: raise TestFailed, 'eval(u\'1+1\')'
! if eval(u' 1+1\n') <> 2: raise TestFailed, 'eval(u\' 1+1\\n\')'
globals = {'a': 1, 'b': 2}
locals = {'b': 200, 'c': 300}
! if eval(u'a', globals) <> 1:
raise TestFailed, "eval(1) == %s" % eval(u'a', globals)
! if eval(u'a', globals, locals) <> 1:
raise TestFailed, "eval(2)"
! if eval(u'b', globals, locals) <> 200:
raise TestFailed, "eval(3)"
! if eval(u'c', globals, locals) <> 300:
raise TestFailed, "eval(4)"
--- 150,176 ----
print 'eval'
! if eval('1+1') != 2: raise TestFailed, 'eval(\'1+1\')'
! if eval(' 1+1\n') != 2: raise TestFailed, 'eval(\' 1+1\\n\')'
globals = {'a': 1, 'b': 2}
locals = {'b': 200, 'c': 300}
! if eval('a', globals) != 1:
raise TestFailed, "eval(1) == %s" % eval('a', globals)
! if eval('a', globals, locals) != 1:
raise TestFailed, "eval(2)"
! if eval('b', globals, locals) != 200:
raise TestFailed, "eval(3)"
! if eval('c', globals, locals) != 300:
raise TestFailed, "eval(4)"
! if eval(u'1+1') != 2: raise TestFailed, 'eval(u\'1+1\')'
! if eval(u' 1+1\n') != 2: raise TestFailed, 'eval(u\' 1+1\\n\')'
globals = {'a': 1, 'b': 2}
locals = {'b': 200, 'c': 300}
! if eval(u'a', globals) != 1:
raise TestFailed, "eval(1) == %s" % eval(u'a', globals)
! if eval(u'a', globals, locals) != 1:
raise TestFailed, "eval(2)"
! if eval(u'b', globals, locals) != 200:
raise TestFailed, "eval(3)"
! if eval(u'c', globals, locals) != 300:
raise TestFailed, "eval(4)"
***************
*** 182,200 ****
f.close()
execfile(TESTFN)
! if z <> 2: raise TestFailed, "execfile(1)"
globals['z'] = 0
execfile(TESTFN, globals)
! if globals['z'] <> 2: raise TestFailed, "execfile(1)"
locals['z'] = 0
execfile(TESTFN, globals, locals)
! if locals['z'] <> 2: raise TestFailed, "execfile(1)"
unlink(TESTFN)
print 'filter'
! if filter(lambda c: 'a' <= c <= 'z', 'Hello World') <> 'elloorld':
raise TestFailed, 'filter (filter a string)'
! if filter(None, [1, 'hello', [], [3], '', None, 9, 0]) <> [1, 'hello', [3], 9]:
raise TestFailed, 'filter (remove false values)'
! if filter(lambda x: x > 0, [1, -3, 9, 0, 2]) <> [1, 9, 2]:
raise TestFailed, 'filter (keep positives)'
class Squares:
--- 182,200 ----
f.close()
execfile(TESTFN)
! if z != 2: raise TestFailed, "execfile(1)"
globals['z'] = 0
execfile(TESTFN, globals)
! if globals['z'] != 2: raise TestFailed, "execfile(1)"
locals['z'] = 0
execfile(TESTFN, globals, locals)
! if locals['z'] != 2: raise TestFailed, "execfile(1)"
unlink(TESTFN)
print 'filter'
! if filter(lambda c: 'a' <= c <= 'z', 'Hello World') != 'elloorld':
raise TestFailed, 'filter (filter a string)'
! if filter(None, [1, 'hello', [], [3], '', None, 9, 0]) != [1, 'hello', [3], 9]:
raise TestFailed, 'filter (remove false values)'
! if filter(lambda x: x > 0, [1, -3, 9, 0, 2]) != [1, 9, 2]:
raise TestFailed, 'filter (keep positives)'
class Squares:
***************
*** 233,242 ****
print 'float'
! if float(3.14) <> 3.14: raise TestFailed, 'float(3.14)'
! if float(314) <> 314.0: raise TestFailed, 'float(314)'
! if float(314L) <> 314.0: raise TestFailed, 'float(314L)'
! if float(" 3.14 ") <> 3.14: raise TestFailed, 'float(" 3.14 ")'
! if float(u" 3.14 ") <> 3.14: raise TestFailed, 'float(u" 3.14 ")'
! if float(u" \u0663.\u0661\u0664 ") <> 3.14:
raise TestFailed, 'float(u" \u0663.\u0661\u0664 ")'
--- 233,242 ----
print 'float'
! if float(3.14) != 3.14: raise TestFailed, 'float(3.14)'
! if float(314) != 314.0: raise TestFailed, 'float(314)'
! if float(314L) != 314.0: raise TestFailed, 'float(314L)'
! if float(" 3.14 ") != 3.14: raise TestFailed, 'float(" 3.14 ")'
! if float(u" 3.14 ") != 3.14: raise TestFailed, 'float(u" 3.14 ")'
! if float(u" \u0663.\u0661\u0664 ") != 3.14:
raise TestFailed, 'float(u" \u0663.\u0661\u0664 ")'
***************
*** 277,292 ****
print 'int'
! if int(314) <> 314: raise TestFailed, 'int(314)'
! if int(3.14) <> 3: raise TestFailed, 'int(3.14)'
! if int(314L) <> 314: raise TestFailed, 'int(314L)'
# Check that conversion from float truncates towards zero
! if int(-3.14) <> -3: raise TestFailed, 'int(-3.14)'
! if int(3.9) <> 3: raise TestFailed, 'int(3.9)'
! if int(-3.9) <> -3: raise TestFailed, 'int(-3.9)'
! if int(3.5) <> 3: raise TestFailed, 'int(3.5)'
! if int(-3.5) <> -3: raise TestFailed, 'int(-3.5)'
# Different base:
! if int("10",16) <> 16L: raise TestFailed, 'int("10",16)'
! if int(u"10",16) <> 16L: raise TestFailed, 'int(u"10",16)'
# Test conversion from strings and various anomalies
L = [
--- 277,292 ----
print 'int'
! if int(314) != 314: raise TestFailed, 'int(314)'
! if int(3.14) != 3: raise TestFailed, 'int(3.14)'
! if int(314L) != 314: raise TestFailed, 'int(314L)'
# Check that conversion from float truncates towards zero
! if int(-3.14) != -3: raise TestFailed, 'int(-3.14)'
! if int(3.9) != 3: raise TestFailed, 'int(3.9)'
! if int(-3.9) != -3: raise TestFailed, 'int(-3.9)'
! if int(3.5) != 3: raise TestFailed, 'int(3.5)'
! if int(-3.5) != -3: raise TestFailed, 'int(-3.5)'
# Different base:
! if int("10",16) != 16L: raise TestFailed, 'int("10",16)'
! if int(u"10",16) != 16L: raise TestFailed, 'int(u"10",16)'
# Test conversion from strings and various anomalies
L = [
***************
*** 386,411 ****
print 'len'
! if len('123') <> 3: raise TestFailed, 'len(\'123\')'
! if len(()) <> 0: raise TestFailed, 'len(())'
! if len((1, 2, 3, 4)) <> 4: raise TestFailed, 'len((1, 2, 3, 4))'
! if len([1, 2, 3, 4]) <> 4: raise TestFailed, 'len([1, 2, 3, 4])'
! if len({}) <> 0: raise TestFailed, 'len({})'
! if len({'a':1, 'b': 2}) <> 2: raise TestFailed, 'len({\'a\':1, \'b\': 2})'
print 'long'
! if long(314) <> 314L: raise TestFailed, 'long(314)'
! if long(3.14) <> 3L: raise TestFailed, 'long(3.14)'
! if long(314L) <> 314L: raise TestFailed, 'long(314L)'
# Check that conversion from float truncates towards zero
! if long(-3.14) <> -3L: raise TestFailed, 'long(-3.14)'
! if long(3.9) <> 3L: raise TestFailed, 'long(3.9)'
! if long(-3.9) <> -3L: raise TestFailed, 'long(-3.9)'
! if long(3.5) <> 3L: raise TestFailed, 'long(3.5)'
! if long(-3.5) <> -3L: raise TestFailed, 'long(-3.5)'
! if long("-3") <> -3L: raise TestFailed, 'long("-3")'
! if long(u"-3") <> -3L: raise TestFailed, 'long(u"-3")'
# Different base:
! if long("10",16) <> 16L: raise TestFailed, 'long("10",16)'
! if long(u"10",16) <> 16L: raise TestFailed, 'long(u"10",16)'
# Check conversions from string (same test set as for int(), and then some)
LL = [
--- 386,411 ----
print 'len'
! if len('123') != 3: raise TestFailed, 'len(\'123\')'
! if len(()) != 0: raise TestFailed, 'len(())'
! if len((1, 2, 3, 4)) != 4: raise TestFailed, 'len((1, 2, 3, 4))'
! if len([1, 2, 3, 4]) != 4: raise TestFailed, 'len([1, 2, 3, 4])'
! if len({}) != 0: raise TestFailed, 'len({})'
! if len({'a':1, 'b': 2}) != 2: raise TestFailed, 'len({\'a\':1, \'b\': 2})'
print 'long'
! if long(314) != 314L: raise TestFailed, 'long(314)'
! if long(3.14) != 3L: raise TestFailed, 'long(3.14)'
! if long(314L) != 314L: raise TestFailed, 'long(314L)'
# Check that conversion from float truncates towards zero
! if long(-3.14) != -3L: raise TestFailed, 'long(-3.14)'
! if long(3.9) != 3L: raise TestFailed, 'long(3.9)'
! if long(-3.9) != -3L: raise TestFailed, 'long(-3.9)'
! if long(3.5) != 3L: raise TestFailed, 'long(3.5)'
! if long(-3.5) != -3L: raise TestFailed, 'long(-3.5)'
! if long("-3") != -3L: raise TestFailed, 'long("-3")'
! if long(u"-3") != -3L: raise TestFailed, 'long(u"-3")'
# Different base:
! if long("10",16) != 16L: raise TestFailed, 'long("10",16)'
! if long(u"10",16) != 16L: raise TestFailed, 'long(u"10",16)'
# Check conversions from string (same test set as for int(), and then some)
LL = [
***************
*** 431,442 ****
print 'map'
! if map(None, 'hello world') <> ['h','e','l','l','o',' ','w','o','r','l','d']:
raise TestFailed, 'map(None, \'hello world\')'
! if map(None, 'abcd', 'efg') <> \
[('a', 'e'), ('b', 'f'), ('c', 'g'), ('d', None)]:
raise TestFailed, 'map(None, \'abcd\', \'efg\')'
! if map(None, range(10)) <> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]:
raise TestFailed, 'map(None, range(10))'
! if map(lambda x: x*x, range(1,4)) <> [1, 4, 9]:
raise TestFailed, 'map(lambda x: x*x, range(1,4))'
try:
--- 431,442 ----
print 'map'
! if map(None, 'hello world') != ['h','e','l','l','o',' ','w','o','r','l','d']:
raise TestFailed, 'map(None, \'hello world\')'
! if map(None, 'abcd', 'efg') != \
[('a', 'e'), ('b', 'f'), ('c', 'g'), ('d', None)]:
raise TestFailed, 'map(None, \'abcd\', \'efg\')'
! if map(None, range(10)) != [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]:
raise TestFailed, 'map(None, range(10))'
! if map(lambda x: x*x, range(1,4)) != [1, 4, 9]:
raise TestFailed, 'map(lambda x: x*x, range(1,4))'
try:
***************
*** 445,451 ****
def sqrt(x):
return pow(x, 0.5)
! if map(lambda x: map(sqrt,x), [[16, 4], [81, 9]]) <> [[4.0, 2.0], [9.0, 3.0]]:
raise TestFailed, 'map(lambda x: map(sqrt,x), [[16, 4], [81, 9]])'
! if map(lambda x, y: x+y, [1,3,2], [9,1,4]) <> [10, 4, 6]:
raise TestFailed, 'map(lambda x,y: x+y, [1,3,2], [9,1,4])'
def plus(*v):
--- 445,451 ----
def sqrt(x):
return pow(x, 0.5)
! if map(lambda x: map(sqrt,x), [[16, 4], [81, 9]]) != [[4.0, 2.0], [9.0, 3.0]]:
raise TestFailed, 'map(lambda x: map(sqrt,x), [[16, 4], [81, 9]])'
! if map(lambda x, y: x+y, [1,3,2], [9,1,4]) != [10, 4, 6]:
raise TestFailed, 'map(lambda x,y: x+y, [1,3,2], [9,1,4])'
def plus(*v):
***************
*** 453,461 ****
for i in v: accu = accu + i
return accu
! if map(plus, [1, 3, 7]) <> [1, 3, 7]:
raise TestFailed, 'map(plus, [1, 3, 7])'
! if map(plus, [1, 3, 7], [4, 9, 2]) <> [1+4, 3+9, 7+2]:
raise TestFailed, 'map(plus, [1, 3, 7], [4, 9, 2])'
! if map(plus, [1, 3, 7], [4, 9, 2], [1, 1, 0]) <> [1+4+1, 3+9+1, 7+2+0]:
raise TestFailed, 'map(plus, [1, 3, 7], [4, 9, 2], [1, 1, 0])'
if map(None, Squares(10)) != [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]:
--- 453,461 ----
for i in v: accu = accu + i
return accu
! if map(plus, [1, 3, 7]) != [1, 3, 7]:
raise TestFailed, 'map(plus, [1, 3, 7])'
! if map(plus, [1, 3, 7], [4, 9, 2]) != [1+4, 3+9, 7+2]:
raise TestFailed, 'map(plus, [1, 3, 7], [4, 9, 2])'
! if map(plus, [1, 3, 7], [4, 9, 2], [1, 1, 0]) != [1+4+1, 3+9+1, 7+2+0]:
raise TestFailed, 'map(plus, [1, 3, 7], [4, 9, 2], [1, 1, 0])'
if map(None, Squares(10)) != [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]:
***************
*** 469,488 ****
print 'max'
! if max('123123') <> '3': raise TestFailed, 'max(\'123123\')'
! if max(1, 2, 3) <> 3: raise TestFailed, 'max(1, 2, 3)'
! if max((1, 2, 3, 1, 2, 3)) <> 3: raise TestFailed, 'max((1, 2, 3, 1, 2, 3))'
! if max([1, 2, 3, 1, 2, 3]) <> 3: raise TestFailed, 'max([1, 2, 3, 1, 2, 3])'
#
! if max(1, 2L, 3.0) <> 3.0: raise TestFailed, 'max(1, 2L, 3.0)'
! if max(1L, 2.0, 3) <> 3: raise TestFailed, 'max(1L, 2.0, 3)'
! if max(1.0, 2, 3L) <> 3L: raise TestFailed, 'max(1.0, 2, 3L)'
print 'min'
! if min('123123') <> '1': raise TestFailed, 'min(\'123123\')'
! if min(1, 2, 3) <> 1: raise TestFailed, 'min(1, 2, 3)'
! if min((1, 2, 3, 1, 2, 3)) <> 1: raise TestFailed, 'min((1, 2, 3, 1, 2, 3))'
! if min([1, 2, 3, 1, 2, 3]) <> 1: raise TestFailed, 'min([1, 2, 3, 1, 2, 3])'
#
! if min(1, 2L, 3.0) <> 1: raise TestFailed, 'min(1, 2L, 3.0)'
! if min(1L, 2.0, 3) <> 1L: raise TestFailed, 'min(1L, 2.0, 3)'
! if min(1.0, 2, 3L) <> 1.0: raise TestFailed, 'min(1.0, 2, 3L)'
--- 469,488 ----
print 'max'
! if max('123123') != '3': raise TestFailed, 'max(\'123123\')'
! if max(1, 2, 3) != 3: raise TestFailed, 'max(1, 2, 3)'
! if max((1, 2, 3, 1, 2, 3)) != 3: raise TestFailed, 'max((1, 2, 3, 1, 2, 3))'
! if max([1, 2, 3, 1, 2, 3]) != 3: raise TestFailed, 'max([1, 2, 3, 1, 2, 3])'
#
! if max(1, 2L, 3.0) != 3.0: raise TestFailed, 'max(1, 2L, 3.0)'
! if max(1L, 2.0, 3) != 3: raise TestFailed, 'max(1L, 2.0, 3)'
! if max(1.0, 2, 3L) != 3L: raise TestFailed, 'max(1.0, 2, 3L)'
print 'min'
! if min('123123') != '1': raise TestFailed, 'min(\'123123\')'
! if min(1, 2, 3) != 1: raise TestFailed, 'min(1, 2, 3)'
! if min((1, 2, 3, 1, 2, 3)) != 1: raise TestFailed, 'min((1, 2, 3, 1, 2, 3))'
! if min([1, 2, 3, 1, 2, 3]) != 1: raise TestFailed, 'min([1, 2, 3, 1, 2, 3])'
#
! if min(1, 2L, 3.0) != 1: raise TestFailed, 'min(1, 2L, 3.0)'
! if min(1L, 2.0, 3) != 1L: raise TestFailed, 'min(1L, 2.0, 3)'
! if min(1.0, 2, 3L) != 1.0: raise TestFailed, 'min(1.0, 2, 3L)'
Index: test_b2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b2.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** test_b2.py 2000/11/08 19:51:25 1.20
--- test_b2.py 2000/12/12 23:11:42 1.21
***************
*** 26,75 ****
fp = open(TESTFN, 'r')
try:
! if fp.readline(4) <> '1+1\n': raise TestFailed, 'readline(4) # exact'
! if fp.readline(4) <> '1+1\n': raise TestFailed, 'readline(4) # exact'
! if fp.readline() <> 'The quick brown fox jumps over the lazy dog.\n':
raise TestFailed, 'readline() # default'
! if fp.readline(4) <> 'Dear': raise TestFailed, 'readline(4) # short'
! if fp.readline(100) <> ' John\n': raise TestFailed, 'readline(100)'
! if fp.read(300) <> 'XXX'*100: raise TestFailed, 'read(300)'
! if fp.read(1000) <> 'YYY'*100: raise TestFailed, 'read(1000) # truncate'
finally:
fp.close()
print 'ord'
! if ord(' ') <> 32: raise TestFailed, 'ord(\' \')'
! if ord('A') <> 65: raise TestFailed, 'ord(\'A\')'
! if ord('a') <> 97: raise TestFailed, 'ord(\'a\')'
print 'pow'
! if pow(0,0) <> 1: raise TestFailed, 'pow(0,0)'
! if pow(0,1) <> 0: raise TestFailed, 'pow(0,1)'
! if pow(1,0) <> 1: raise TestFailed, 'pow(1,0)'
! if pow(1,1) <> 1: raise TestFailed, 'pow(1,1)'
#
! if pow(2,0) <> 1: raise TestFailed, 'pow(2,0)'
! if pow(2,10) <> 1024: raise TestFailed, 'pow(2,10)'
! if pow(2,20) <> 1024*1024: raise TestFailed, 'pow(2,20)'
! if pow(2,30) <> 1024*1024*1024: raise TestFailed, 'pow(2,30)'
#
! if pow(-2,0) <> 1: raise TestFailed, 'pow(-2,0)'
! if pow(-2,1) <> -2: raise TestFailed, 'pow(-2,1)'
! if pow(-2,2) <> 4: raise TestFailed, 'pow(-2,2)'
! if pow(-2,3) <> -8: raise TestFailed, 'pow(-2,3)'
#
! if pow(0L,0) <> 1: raise TestFailed, 'pow(0L,0)'
! if pow(0L,1) <> 0: raise TestFailed, 'pow(0L,1)'
! if pow(1L,0) <> 1: raise TestFailed, 'pow(1L,0)'
! if pow(1L,1) <> 1: raise TestFailed, 'pow(1L,1)'
#
! if pow(2L,0) <> 1: raise TestFailed, 'pow(2L,0)'
! if pow(2L,10) <> 1024: raise TestFailed, 'pow(2L,10)'
! if pow(2L,20) <> 1024*1024: raise TestFailed, 'pow(2L,20)'
! if pow(2L,30) <> 1024*1024*1024: raise TestFailed, 'pow(2L,30)'
#
! if pow(-2L,0) <> 1: raise TestFailed, 'pow(-2L,0)'
! if pow(-2L,1) <> -2: raise TestFailed, 'pow(-2L,1)'
! if pow(-2L,2) <> 4: raise TestFailed, 'pow(-2L,2)'
! if pow(-2L,3) <> -8: raise TestFailed, 'pow(-2L,3)'
#
if fcmp(pow(0.,0), 1.): raise TestFailed, 'pow(0.,0)'
--- 26,75 ----
fp = open(TESTFN, 'r')
try:
! if fp.readline(4) != '1+1\n': raise TestFailed, 'readline(4) # exact'
! if fp.readline(4) != '1+1\n': raise TestFailed, 'readline(4) # exact'
! if fp.readline() != 'The quick brown fox jumps over the lazy dog.\n':
raise TestFailed, 'readline() # default'
! if fp.readline(4) != 'Dear': raise TestFailed, 'readline(4) # short'
! if fp.readline(100) != ' John\n': raise TestFailed, 'readline(100)'
! if fp.read(300) != 'XXX'*100: raise TestFailed, 'read(300)'
! if fp.read(1000) != 'YYY'*100: raise TestFailed, 'read(1000) # truncate'
finally:
fp.close()
print 'ord'
! if ord(' ') != 32: raise TestFailed, 'ord(\' \')'
! if ord('A') != 65: raise TestFailed, 'ord(\'A\')'
! if ord('a') != 97: raise TestFailed, 'ord(\'a\')'
print 'pow'
! if pow(0,0) != 1: raise TestFailed, 'pow(0,0)'
! if pow(0,1) != 0: raise TestFailed, 'pow(0,1)'
! if pow(1,0) != 1: raise TestFailed, 'pow(1,0)'
! if pow(1,1) != 1: raise TestFailed, 'pow(1,1)'
#
! if pow(2,0) != 1: raise TestFailed, 'pow(2,0)'
! if pow(2,10) != 1024: raise TestFailed, 'pow(2,10)'
! if pow(2,20) != 1024*1024: raise TestFailed, 'pow(2,20)'
! if pow(2,30) != 1024*1024*1024: raise TestFailed, 'pow(2,30)'
#
! if pow(-2,0) != 1: raise TestFailed, 'pow(-2,0)'
! if pow(-2,1) != -2: raise TestFailed, 'pow(-2,1)'
! if pow(-2,2) != 4: raise TestFailed, 'pow(-2,2)'
! if pow(-2,3) != -8: raise TestFailed, 'pow(-2,3)'
#
! if pow(0L,0) != 1: raise TestFailed, 'pow(0L,0)'
! if pow(0L,1) != 0: raise TestFailed, 'pow(0L,1)'
! if pow(1L,0) != 1: raise TestFailed, 'pow(1L,0)'
! if pow(1L,1) != 1: raise TestFailed, 'pow(1L,1)'
#
! if pow(2L,0) != 1: raise TestFailed, 'pow(2L,0)'
! if pow(2L,10) != 1024: raise TestFailed, 'pow(2L,10)'
! if pow(2L,20) != 1024*1024: raise TestFailed, 'pow(2L,20)'
! if pow(2L,30) != 1024*1024*1024: raise TestFailed, 'pow(2L,30)'
#
! if pow(-2L,0) != 1: raise TestFailed, 'pow(-2L,0)'
! if pow(-2L,1) != -2: raise TestFailed, 'pow(-2L,1)'
! if pow(-2L,2) != 4: raise TestFailed, 'pow(-2L,2)'
! if pow(-2L,3) != -8: raise TestFailed, 'pow(-2L,3)'
#
if fcmp(pow(0.,0), 1.): raise TestFailed, 'pow(0.,0)'
***************
*** 96,105 ****
print 'range'
! if range(3) <> [0, 1, 2]: raise TestFailed, 'range(3)'
! if range(1, 5) <> [1, 2, 3, 4]: raise TestFailed, 'range(1, 5)'
! if range(0) <> []: raise TestFailed, 'range(0)'
! if range(-3) <> []: raise TestFailed, 'range(-3)'
! if range(1, 10, 3) <> [1, 4, 7]: raise TestFailed, 'range(1, 10, 3)'
! if range(5, -5, -3) <> [5, 2, -1, -4]: raise TestFailed, 'range(5, -5, -3)'
print 'input and raw_input'
--- 96,105 ----
print 'range'
! if range(3) != [0, 1, 2]: raise TestFailed, 'range(3)'
! if range(1, 5) != [1, 2, 3, 4]: raise TestFailed, 'range(1, 5)'
! if range(0) != []: raise TestFailed, 'range(0)'
! if range(-3) != []: raise TestFailed, 'range(-3)'
! if range(1, 10, 3) != [1, 4, 7]: raise TestFailed, 'range(1, 10, 3)'
! if range(5, -5, -3) != [5, 2, -1, -4]: raise TestFailed, 'range(5, -5, -3)'
print 'input and raw_input'
***************
*** 109,117 ****
try:
sys.stdin = fp
! if input() <> 2: raise TestFailed, 'input()'
! if input('testing\n') <> 2: raise TestFailed, 'input()'
! if raw_input() <> 'The quick brown fox jumps over the lazy dog.':
raise TestFailed, 'raw_input()'
! if raw_input('testing\n') <> 'Dear John':
raise TestFailed, 'raw_input(\'testing\\n\')'
finally:
--- 109,117 ----
try:
sys.stdin = fp
! if input() != 2: raise TestFailed, 'input()'
! if input('testing\n') != 2: raise TestFailed, 'input()'
! if raw_input() != 'The quick brown fox jumps over the lazy dog.':
raise TestFailed, 'raw_input()'
! if raw_input('testing\n') != 'Dear John':
raise TestFailed, 'raw_input(\'testing\\n\')'
finally:
***************
*** 120,131 ****
print 'reduce'
! if reduce(lambda x, y: x+y, ['a', 'b', 'c'], '') <> 'abc':
raise TestFailed, 'reduce(): implode a string'
if reduce(lambda x, y: x+y,
! [['a', 'c'], [], ['d', 'w']], []) <> ['a','c','d','w']:
raise TestFailed, 'reduce(): append'
! if reduce(lambda x, y: x*y, range(2,8), 1) <> 5040:
raise TestFailed, 'reduce(): compute 7!'
! if reduce(lambda x, y: x*y, range(2,21), 1L) <> 2432902008176640000L:
raise TestFailed, 'reduce(): compute 20!, use long'
class Squares:
--- 120,131 ----
print 'reduce'
! if reduce(lambda x, y: x+y, ['a', 'b', 'c'], '') != 'abc':
raise TestFailed, 'reduce(): implode a string'
if reduce(lambda x, y: x+y,
! [['a', 'c'], [], ['d', 'w']], []) != ['a','c','d','w']:
raise TestFailed, 'reduce(): append'
! if reduce(lambda x, y: x*y, range(2,8), 1) != 5040:
raise TestFailed, 'reduce(): compute 7!'
! if reduce(lambda x, y: x*y, range(2,21), 1L) != 2432902008176640000L:
raise TestFailed, 'reduce(): compute 20!, use long'
class Squares:
***************
*** 160,203 ****
print 'repr'
! if repr('') <> '\'\'': raise TestFailed, 'repr(\'\')'
! if repr(0) <> '0': raise TestFailed, 'repr(0)'
! if repr(0L) <> '0L': raise TestFailed, 'repr(0L)'
! if repr(()) <> '()': raise TestFailed, 'repr(())'
! if repr([]) <> '[]': raise TestFailed, 'repr([])'
! if repr({}) <> '{}': raise TestFailed, 'repr({})'
print 'round'
! if round(0.0) <> 0.0: raise TestFailed, 'round(0.0)'
! if round(1.0) <> 1.0: raise TestFailed, 'round(1.0)'
! if round(10.0) <> 10.0: raise TestFailed, 'round(10.0)'
! if round(1000000000.0) <> 1000000000.0:
raise TestFailed, 'round(1000000000.0)'
! if round(1e20) <> 1e20: raise TestFailed, 'round(1e20)'
! if round(-1.0) <> -1.0: raise TestFailed, 'round(-1.0)'
! if round(-10.0) <> -10.0: raise TestFailed, 'round(-10.0)'
! if round(-1000000000.0) <> -1000000000.0:
raise TestFailed, 'round(-1000000000.0)'
! if round(-1e20) <> -1e20: raise TestFailed, 'round(-1e20)'
! if round(0.1) <> 0.0: raise TestFailed, 'round(0.0)'
! if round(1.1) <> 1.0: raise TestFailed, 'round(1.0)'
! if round(10.1) <> 10.0: raise TestFailed, 'round(10.0)'
! if round(1000000000.1) <> 1000000000.0:
raise TestFailed, 'round(1000000000.0)'
! if round(-1.1) <> -1.0: raise TestFailed, 'round(-1.0)'
! if round(-10.1) <> -10.0: raise TestFailed, 'round(-10.0)'
! if round(-1000000000.1) <> -1000000000.0:
raise TestFailed, 'round(-1000000000.0)'
! if round(0.9) <> 1.0: raise TestFailed, 'round(0.9)'
! if round(9.9) <> 10.0: raise TestFailed, 'round(9.9)'
! if round(999999999.9) <> 1000000000.0:
raise TestFailed, 'round(999999999.9)'
! if round(-0.9) <> -1.0: raise TestFailed, 'round(-0.9)'
! if round(-9.9) <> -10.0: raise TestFailed, 'round(-9.9)'
! if round(-999999999.9) <> -1000000000.0:
raise TestFailed, 'round(-999999999.9)'
--- 160,203 ----
print 'repr'
! if repr('') != '\'\'': raise TestFailed, 'repr(\'\')'
! if repr(0) != '0': raise TestFailed, 'repr(0)'
! if repr(0L) != '0L': raise TestFailed, 'repr(0L)'
! if repr(()) != '()': raise TestFailed, 'repr(())'
! if repr([]) != '[]': raise TestFailed, 'repr([])'
! if repr({}) != '{}': raise TestFailed, 'repr({})'
print 'round'
! if round(0.0) != 0.0: raise TestFailed, 'round(0.0)'
! if round(1.0) != 1.0: raise TestFailed, 'round(1.0)'
! if round(10.0) != 10.0: raise TestFailed, 'round(10.0)'
! if round(1000000000.0) != 1000000000.0:
raise TestFailed, 'round(1000000000.0)'
! if round(1e20) != 1e20: raise TestFailed, 'round(1e20)'
! if round(-1.0) != -1.0: raise TestFailed, 'round(-1.0)'
! if round(-10.0) != -10.0: raise TestFailed, 'round(-10.0)'
! if round(-1000000000.0) != -1000000000.0:
raise TestFailed, 'round(-1000000000.0)'
! if round(-1e20) != -1e20: raise TestFailed, 'round(-1e20)'
! if round(0.1) != 0.0: raise TestFailed, 'round(0.0)'
! if round(1.1) != 1.0: raise TestFailed, 'round(1.0)'
! if round(10.1) != 10.0: raise TestFailed, 'round(10.0)'
! if round(1000000000.1) != 1000000000.0:
raise TestFailed, 'round(1000000000.0)'
! if round(-1.1) != -1.0: raise TestFailed, 'round(-1.0)'
! if round(-10.1) != -10.0: raise TestFailed, 'round(-10.0)'
! if round(-1000000000.1) != -1000000000.0:
raise TestFailed, 'round(-1000000000.0)'
! if round(0.9) != 1.0: raise TestFailed, 'round(0.9)'
! if round(9.9) != 10.0: raise TestFailed, 'round(9.9)'
! if round(999999999.9) != 1000000000.0:
raise TestFailed, 'round(999999999.9)'
! if round(-0.9) != -1.0: raise TestFailed, 'round(-0.9)'
! if round(-9.9) != -10.0: raise TestFailed, 'round(-9.9)'
! if round(-999999999.9) != -1000000000.0:
raise TestFailed, 'round(-999999999.9)'
***************
*** 208,228 ****
print 'str'
! if str('') <> '': raise TestFailed, 'str(\'\')'
! if str(0) <> '0': raise TestFailed, 'str(0)'
! if str(0L) <> '0': raise TestFailed, 'str(0L)'
! if str(()) <> '()': raise TestFailed, 'str(())'
! if str([]) <> '[]': raise TestFailed, 'str([])'
! if str({}) <> '{}': raise TestFailed, 'str({})'
print 'tuple'
! if tuple(()) <> (): raise TestFailed, 'tuple(())'
! if tuple((0, 1, 2, 3)) <> (0, 1, 2, 3): raise TestFailed, 'tuple((0, 1, 2, 3))'
! if tuple([]) <> (): raise TestFailed, 'tuple([])'
! if tuple([0, 1, 2, 3]) <> (0, 1, 2, 3): raise TestFailed, 'tuple([0, 1, 2, 3])'
! if tuple('') <> (): raise TestFailed, 'tuple('')'
! if tuple('spam') <> ('s', 'p', 'a', 'm'): raise TestFailed, "tuple('spam')"
print 'type'
! if type('') <> type('123') or type('') == type(()):
raise TestFailed, 'type()'
--- 208,228 ----
print 'str'
! if str('') != '': raise TestFailed, 'str(\'\')'
! if str(0) != '0': raise TestFailed, 'str(0)'
! if str(0L) != '0': raise TestFailed, 'str(0L)'
! if str(()) != '()': raise TestFailed, 'str(())'
! if str([]) != '[]': raise TestFailed, 'str([])'
! if str({}) != '{}': raise TestFailed, 'str({})'
print 'tuple'
! if tuple(()) != (): raise TestFailed, 'tuple(())'
! if tuple((0, 1, 2, 3)) != (0, 1, 2, 3): raise TestFailed, 'tuple((0, 1, 2, 3))'
! if tuple([]) != (): raise TestFailed, 'tuple([])'
! if tuple([0, 1, 2, 3]) != (0, 1, 2, 3): raise TestFailed, 'tuple([0, 1, 2, 3])'
! if tuple('') != (): raise TestFailed, 'tuple('')'
! if tuple('spam') != ('s', 'p', 'a', 'm'): raise TestFailed, "tuple('spam')"
print 'type'
! if type('') != type('123') or type('') == type(()):
raise TestFailed, 'type()'
***************
*** 233,237 ****
a.sort()
b.sort()
! if a <> b: raise TestFailed, 'vars()'
import sys
a = vars(sys).keys()
--- 233,237 ----
a.sort()
b.sort()
! if a != b: raise TestFailed, 'vars()'
import sys
a = vars(sys).keys()
***************
*** 239,243 ****
a.sort()
b.sort()
! if a <> b: raise TestFailed, 'vars(sys)'
def f0():
if vars() != {}: raise TestFailed, 'vars() in f0()'
--- 239,243 ----
a.sort()
b.sort()
! if a != b: raise TestFailed, 'vars(sys)'
def f0():
if vars() != {}: raise TestFailed, 'vars() in f0()'
***************
*** 251,257 ****
print 'xrange'
! if tuple(xrange(10)) <> tuple(range(10)): raise TestFailed, 'xrange(10)'
! if tuple(xrange(5,10)) <> tuple(range(5,10)): raise TestFailed, 'xrange(5,10)'
! if tuple(xrange(0,10,2)) <> tuple(range(0,10,2)):
raise TestFailed, 'xrange(0,10,2)'
# regression tests for SourceForge bug #121695
--- 251,257 ----
print 'xrange'
! if tuple(xrange(10)) != tuple(range(10)): raise TestFailed, 'xrange(10)'
! if tuple(xrange(5,10)) != tuple(range(5,10)): raise TestFailed, 'xrange(5,10)'
! if tuple(xrange(0,10,2)) != tuple(range(0,10,2)):
raise TestFailed, 'xrange(0,10,2)'
# regression tests for SourceForge bug #121695
***************
*** 274,287 ****
b = (4, 5, 6)
t = [(1, 4), (2, 5), (3, 6)]
! if zip(a, b) <> t: raise TestFailed, 'zip(a, b) - same size, both tuples'
b = [4, 5, 6]
! if zip(a, b) <> t: raise TestFailed, 'zip(a, b) - same size, tuple/list'
b = (4, 5, 6, 7)
! if zip(a, b) <> t: raise TestFailed, 'zip(a, b) - b is longer'
class I:
def __getitem__(self, i):
if i < 0 or i > 2: raise IndexError
return i + 4
! if zip(a, I()) <> t: raise TestFailed, 'zip(a, b) - b is instance'
exc = 0
try:
--- 274,287 ----
b = (4, 5, 6)
t = [(1, 4), (2, 5), (3, 6)]
! if zip(a, b) != t: raise TestFailed, 'zip(a, b) - same size, both tuples'
b = [4, 5, 6]
! if zip(a, b) != t: raise TestFailed, 'zip(a, b) - same size, tuple/list'
b = (4, 5, 6, 7)
! if zip(a, b) != t: raise TestFailed, 'zip(a, b) - b is longer'
class I:
def __getitem__(self, i):
if i < 0 or i > 2: raise IndexError
return i + 4
! if zip(a, I()) != t: raise TestFailed, 'zip(a, b) - b is instance'
exc = 0
try:
Index: test_binascii.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binascii.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** test_binascii.py 2000/08/15 06:08:31 1.6
--- test_binascii.py 2000/12/12 23:11:42 1.7
***************
*** 97,101 ****
t = binascii.b2a_hex(s)
u = binascii.a2b_hex(t)
! if s <> u:
print 'binascii hexlification failed'
try:
--- 97,101 ----
t = binascii.b2a_hex(s)
u = binascii.a2b_hex(t)
! if s != u:
print 'binascii hexlification failed'
try:
Index: test_binhex.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binhex.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** test_binhex.py 2000/10/23 17:22:07 1.6
--- test_binhex.py 2000/12/12 23:11:42 1.7
***************
*** 33,38 ****
finish = f.readline()
! if start <> finish:
! print 'Error: binhex <> hexbin'
elif verbose:
print 'binhex == hexbin'
--- 33,38 ----
finish = f.readline()
! if start != finish:
! print 'Error: binhex != hexbin'
elif verbose:
print 'binhex == hexbin'
Index: test_bsddb.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bsddb.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_bsddb.py 2000/10/23 17:22:07 1.4
--- test_bsddb.py 2000/12/12 23:11:42 1.5
***************
*** 35,40 ****
rec = f.next()
except KeyError:
! if rec <> f.last():
! print 'Error, last <> last!'
f.previous()
break
--- 35,40 ----
rec = f.next()
except KeyError:
! if rec != f.last():
! print 'Error, last != last!'
f.previous()
break
Index: test_grammar.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grammar.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** test_grammar.py 2000/10/23 17:22:07 1.20
--- test_grammar.py 2000/12/12 23:11:42 1.21
***************
*** 13,27 ****
x = 1 \
+ 1
! if x <> 2: raise TestFailed, 'backslash for line continuation'
# Backslash does not means continuation in comments :\
x = 0
! if x <> 0: raise TestFailed, 'backslash ending comment'
print '1.1.2 Numeric literals'
print '1.1.2.1 Plain integers'
! if 0xff <> 255: raise TestFailed, 'hex int'
! if 0377 <> 255: raise TestFailed, 'octal int'
if 2147483647 != 017777777777: raise TestFailed, 'large positive int'
try:
--- 13,27 ----
x = 1 \
+ 1
! if x != 2: raise TestFailed, 'backslash for line continuation'
# Backslash does not means continuation in comments :\
x = 0
! if x != 0: raise TestFailed, 'backslash ending comment'
print '1.1.2 Numeric literals'
print '1.1.2.1 Plain integers'
! if 0xff != 255: raise TestFailed, 'hex int'
! if 0377 != 255: raise TestFailed, 'octal int'
if 2147483647 != 017777777777: raise TestFailed, 'large positive int'
try:
***************
*** 360,379 ****
del z
exec 'z=1+1\n'
! if z <> 2: raise TestFailed, 'exec \'z=1+1\'\\n'
del z
exec 'z=1+1'
! if z <> 2: raise TestFailed, 'exec \'z=1+1\''
z = None
del z
exec u'z=1+1\n'
! if z <> 2: raise TestFailed, 'exec u\'z=1+1\'\\n'
del z
exec u'z=1+1'
! if z <> 2: raise TestFailed, 'exec u\'z=1+1\''
f()
g = {}
exec 'z = 1' in g
if g.has_key('__builtins__'): del g['__builtins__']
! if g <> {'z': 1}: raise TestFailed, 'exec \'z = 1\' in g'
g = {}
l = {}
--- 360,379 ----
del z
exec 'z=1+1\n'
! if z != 2: raise TestFailed, 'exec \'z=1+1\'\\n'
del z
exec 'z=1+1'
! if z != 2: raise TestFailed, 'exec \'z=1+1\''
z = None
del z
exec u'z=1+1\n'
! if z != 2: raise TestFailed, 'exec u\'z=1+1\'\\n'
del z
exec u'z=1+1'
! if z != 2: raise TestFailed, 'exec u\'z=1+1\''
f()
g = {}
exec 'z = 1' in g
if g.has_key('__builtins__'): del g['__builtins__']
! if g != {'z': 1}: raise TestFailed, 'exec \'z = 1\' in g'
g = {}
l = {}
***************
*** 381,385 ****
if g.has_key('__builtins__'): del g['__builtins__']
if l.has_key('__builtins__'): del l['__builtins__']
! if (g, l) <> ({'a':1}, {'b':2}): raise TestFailed, 'exec ... in g, l'
--- 381,385 ----
if g.has_key('__builtins__'): del g['__builtins__']
if l.has_key('__builtins__'): del l['__builtins__']
! if (g, l) != ({'a':1}, {'b':2}): raise TestFailed, 'exec ... in g, l'
Index: test_math.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_math.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** test_math.py 2000/10/23 17:22:07 1.9
--- test_math.py 2000/12/12 23:11:42 1.10
***************
*** 86,90 ****
print 'frexp'
def testfrexp(name, (mant, exp), (emant, eexp)):
! if abs(mant-emant) > eps or exp <> eexp:
raise TestFailed, '%s returned %s, expected %s'%\
(name, `mant, exp`, `emant,eexp`)
--- 86,90 ----
print 'frexp'
def testfrexp(name, (mant, exp), (emant, eexp)):
! if abs(mant-emant) > eps or exp != eexp:
raise TestFailed, '%s returned %s, expected %s'%\
(name, `mant, exp`, `emant,eexp`)
Index: test_md5.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_md5.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** test_md5.py 2000/10/23 17:22:07 1.3
--- test_md5.py 2000/12/12 23:11:42 1.4
***************
*** 27,30 ****
m = md5('testing the hexdigest method')
h = m.hexdigest()
! if hexstr(m.digest()) <> h:
print 'hexdigest() failed'
--- 27,30 ----
m = md5('testing the hexdigest method')
h = m.hexdigest()
! if hexstr(m.digest()) != h:
print 'hexdigest() failed'
Index: test_mmap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** test_mmap.py 2000/10/23 17:22:07 1.11
--- test_mmap.py 2000/12/12 23:11:42 1.12
***************
*** 47,51 ****
# Test doing a regular expression match in an mmap'ed file
match=re.search('[A-Za-z]+', m)
! if match == None:
print ' ERROR: regex match on mmap failed!'
else:
--- 47,51 ----
# Test doing a regular expression match in an mmap'ed file
match=re.search('[A-Za-z]+', m)
! if match is None:
print ' ERROR: regex match on mmap failed!'
else:
Index: test_new.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_new.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** test_new.py 1998/03/26 19:42:19 1.5
--- test_new.py 2000/12/12 23:11:42 1.6
***************
*** 34,41 ****
print im
! if c.get_yolks() <> 3 and c.get_more_yolks() <> 6:
print 'Broken call of hand-crafted class instance'
im()
! if c.get_yolks() <> 1 and c.get_more_yolks() <> 4:
print 'Broken call of hand-crafted instance method'
--- 34,41 ----
print im
! if c.get_yolks() != 3 and c.get_more_yolks() != 6:
print 'Broken call of hand-crafted class instance'
im()
! if c.get_yolks() != 1 and c.get_more_yolks() != 4:
print 'Broken call of hand-crafted instance method'
***************
*** 54,58 ****
print func
func()
! if g['c'] <> 3:
print 'Could not create a proper function object'
--- 54,58 ----
print func
func()
! if g['c'] != 3:
print 'Could not create a proper function object'
Index: test_nis.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_nis.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** test_nis.py 2000/08/04 13:34:43 1.8
--- test_nis.py 2000/12/12 23:11:42 1.9
***************
*** 22,26 ****
if not k:
continue
! if nis.match(k, nismap) <> v:
print "NIS match failed for key `%s' in map `%s'" % (k, nismap)
else:
--- 22,26 ----
if not k:
continue
! if nis.match(k, nismap) != v:
print "NIS match failed for key `%s' in map `%s'" % (k, nismap)
else:
Index: test_opcodes.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_opcodes.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** test_opcodes.py 2000/10/23 17:22:07 1.8
--- test_opcodes.py 2000/12/12 23:11:42 1.9
***************
*** 20,24 ****
finally: pass
n = n+i
! if n <> 90:
raise TestFailed, 'try inside for'
--- 20,24 ----
finally: pass
n = n+i
! if n != 90:
raise TestFailed, 'try inside for'
Index: test_operator.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_operator.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** test_operator.py 1998/03/26 19:42:25 1.3
--- test_operator.py 2000/12/12 23:11:42 1.4
***************
*** 10,14 ****
except:
val = sys.exc_type
! if val <> output:
print '%s%s = %s: %s expected' % (f.__name__, params, `val`, `output`)
--- 10,14 ----
except:
val = sys.exc_type
! if val != output:
print '%s%s = %s: %s expected' % (f.__name__, params, `val`, `output`)
***************
*** 22,31 ****
a = [4, 3, 2, 1]
test('delitem', a, None, 1)
! if a <> [4, 2, 1]:
print 'delitem() failed'
a = range(10)
test('delslice', a, None, 2, 8)
! if a <> [0, 1, 8, 9]:
print 'delslice() failed'
--- 22,31 ----
a = [4, 3, 2, 1]
test('delitem', a, None, 1)
! if a != [4, 2, 1]:
print 'delitem() failed'
a = range(10)
test('delslice', a, None, 2, 8)
! if a != [0, 1, 8, 9]:
print 'delslice() failed'
***************
*** 60,69 ****
test('setitem', a, None, 0, 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]:
print 'setslice() failed:', a
--- 60,69 ----
test('setitem', a, None, 0, 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]:
print 'setslice() failed:', a
Index: test_pow.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pow.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** test_pow.py 2000/10/23 17:22:07 1.6
--- test_pow.py 2000/12/12 23:11:42 1.7
***************
*** 111,119 ****
n = pow(i,j,k)
if o != n: print 'Integer mismatch:', i,j,k
! if j >= 0 and k <> 0:
o = pow(long(i),j) % k
n = pow(long(i),j,k)
if o != n: print 'Long mismatch:', i,j,k
! if i >= 0 and k <> 0:
o = pow(float(i),j) % k
n = pow(float(i),j,k)
--- 111,119 ----
n = pow(i,j,k)
if o != n: print 'Integer mismatch:', i,j,k
! if j >= 0 and k != 0:
o = pow(long(i),j) % k
n = pow(long(i),j,k)
if o != n: print 'Long mismatch:', i,j,k
! if i >= 0 and k != 0:
o = pow(float(i),j) % k
n = pow(float(i),j,k)
Index: test_pty.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pty.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** test_pty.py 2000/10/23 17:22:07 1.6
--- test_pty.py 2000/12/12 23:11:42 1.7
***************
*** 82,86 ****
elif status / 256 == 3:
raise TestFailed, "Child spawned by pty.fork() did not have a tty as stdout"
! elif status / 256 <> 4:
raise TestFailed, "pty.fork() failed for unknown reasons:"
print os.read(master_fd, 65536)
--- 82,86 ----
elif status / 256 == 3:
raise TestFailed, "Child spawned by pty.fork() did not have a tty as stdout"
! elif status / 256 != 4:
raise TestFailed, "pty.fork() failed for unknown reasons:"
print os.read(master_fd, 65536)
Index: test_pwd.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pwd.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** test_pwd.py 2000/10/23 17:22:07 1.7
--- test_pwd.py 2000/12/12 23:11:42 1.8
***************
*** 13,21 ****
print 'pwd.getpwuid()'
dbuid = pwd.getpwuid(uid)
! if dbuid[0] <> name:
print 'Mismatch in pwd.getpwuid()'
print 'pwd.getpwnam()'
dbname = pwd.getpwnam(name)
! if dbname[2] <> uid:
print 'Mismatch in pwd.getpwnam()'
else:
--- 13,21 ----
print 'pwd.getpwuid()'
dbuid = pwd.getpwuid(uid)
! if dbuid[0] != name:
print 'Mismatch in pwd.getpwuid()'
print 'pwd.getpwnam()'
dbname = pwd.getpwnam(name)
! if dbname[2] != uid:
print 'Mismatch in pwd.getpwnam()'
else:
Index: test_re.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** test_re.py 2000/10/23 17:22:08 1.26
--- test_re.py 2000/12/12 23:11:42 1.27
***************
*** 16,20 ****
assert re.search('x+', 'axx').span(0) == (1, 3)
assert re.search('x+', 'axx').span() == (1, 3)
! assert re.search('x', 'aaa') == None
except:
raise TestFailed, "re.search"
--- 16,20 ----
assert re.search('x+', 'axx').span(0) == (1, 3)
assert re.search('x+', 'axx').span() == (1, 3)
! assert re.search('x', 'aaa') is None
except:
raise TestFailed, "re.search"
***************
*** 25,29 ****
assert re.match('x*', 'xxxa').span(0) == (0, 3)
assert re.match('x*', 'xxxa').span() == (0, 3)
! assert re.match('a+', 'xxx') == None
except:
raise TestFailed, "re.search"
--- 25,29 ----
assert re.match('x*', 'xxxa').span(0) == (0, 3)
assert re.match('x*', 'xxxa').span() == (0, 3)
! assert re.match('a+', 'xxx') is None
except:
raise TestFailed, "re.search"
***************
*** 217,225 ****
for i in range(0, 256):
p = p + chr(i)
! assert re.match(re.escape(chr(i)), chr(i)) != None
assert re.match(re.escape(chr(i)), chr(i)).span() == (0,1)
pat=re.compile( re.escape(p) )
! assert pat.match(p) != None
assert pat.match(p).span() == (0,256)
except AssertionError:
--- 217,225 ----
for i in range(0, 256):
p = p + chr(i)
! assert re.match(re.escape(chr(i)), chr(i)) is not None
assert re.match(re.escape(chr(i)), chr(i)).span() == (0,1)
pat=re.compile( re.escape(p) )
! assert pat.match(p) is not None
assert pat.match(p).span() == (0,256)
except AssertionError:
***************
*** 336,340 ****
# still succeeds.
result = obj.search(unicode(s, "latin-1"))
! if result == None:
print '=== Fails on unicode match', t
--- 336,340 ----
# still succeeds.
result = obj.search(unicode(s, "latin-1"))
! if result is None:
print '=== Fails on unicode match', t
***************
*** 343,347 ****
obj=re.compile(unicode(pattern, "latin-1"))
result = obj.search(s)
! if result == None:
print '=== Fails on unicode pattern match', t
--- 343,347 ----
obj=re.compile(unicode(pattern, "latin-1"))
result = obj.search(s)
! if result is None:
print '=== Fails on unicode pattern match', t
***************
*** 352,359 ****
if pattern[:2] != '\\B' and pattern[-2:] != '\\B' \
! and result != None:
obj = re.compile(pattern)
result = obj.search(s, result.start(0), result.end(0) + 1)
! if result == None:
print '=== Failed on range-limited match', t
--- 352,359 ----
if pattern[:2] != '\\B' and pattern[-2:] != '\\B' \
! and result is not None:
obj = re.compile(pattern)
result = obj.search(s, result.start(0), result.end(0) + 1)
! if result is None:
print '=== Failed on range-limited match', t
***************
*** 362,366 ****
obj = re.compile(pattern, re.IGNORECASE)
result = obj.search(s)
! if result == None:
print '=== Fails on case-insensitive match', t
--- 362,366 ----
obj = re.compile(pattern, re.IGNORECASE)
result = obj.search(s)
! if result is None:
print '=== Fails on case-insensitive match', t
***************
*** 369,373 ****
obj = re.compile(pattern, re.LOCALE)
result = obj.search(s)
! if result == None:
print '=== Fails on locale-sensitive match', t
--- 369,373 ----
obj = re.compile(pattern, re.LOCALE)
result = obj.search(s)
! if result is None:
print '=== Fails on locale-sensitive match', t
***************
*** 376,379 ****
obj = re.compile(pattern, re.UNICODE)
result = obj.search(s)
! if result == None:
print '=== Fails on unicode-sensitive match', t
--- 376,379 ----
obj = re.compile(pattern, re.UNICODE)
result = obj.search(s)
! if result is None:
print '=== Fails on unicode-sensitive match', t
Index: test_rotor.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_rotor.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_rotor.py 1997/08/18 13:42:28 1.4
--- test_rotor.py 2000/12/12 23:11:42 1.5
***************
*** 14,23 ****
A1 = r.decrypt(a)
print A1
! if A1 <> A:
print 'decrypt failed'
B1 = r.decryptmore(b)
print B1
! if B1 <> B:
print 'decryptmore failed'
--- 14,23 ----
A1 = r.decrypt(a)
print A1
! if A1 != A:
print 'decrypt failed'
B1 = r.decryptmore(b)
print B1
! if B1 != B:
print 'decryptmore failed'
Index: test_sax.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sax.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** test_sax.py 2000/10/24 16:00:22 1.13
--- test_sax.py 2000/12/12 23:11:42 1.14
***************
*** 396,401 ****
parser.close()
! return parser.getSystemId() == None and \
! parser.getPublicId() == None and \
parser.getLineNumber() == 1
--- 396,401 ----
parser.close()
! return parser.getSystemId() is None and \
! parser.getPublicId() is None and \
parser.getLineNumber() == 1
***************
*** 408,412 ****
return parser.getSystemId() == findfile("test.xml") and \
! parser.getPublicId() == None
--- 408,412 ----
return parser.getSystemId() == findfile("test.xml") and \
! parser.getPublicId() is None
***************
*** 485,489 ****
not attrs.has_key("attr") and \
attrs.keys() == [] and \
! attrs.get("attrs") == None and \
attrs.get("attrs", 25) == 25 and \
attrs.items() == [] and \
--- 485,489 ----
not attrs.has_key("attr") and \
attrs.keys() == [] and \
! attrs.get("attrs") is None and \
attrs.get("attrs", 25) == 25 and \
attrs.items() == [] and \
***************
*** 553,557 ****
not attrs.has_key((ns_uri, "attr")) and \
attrs.keys() == [] and \
! attrs.get((ns_uri, "attr")) == None and \
attrs.get((ns_uri, "attr"), 25) == 25 and \
attrs.items() == [] and \
--- 553,557 ----
not attrs.has_key((ns_uri, "attr")) and \
attrs.keys() == [] and \
! attrs.get((ns_uri, "attr")) is None and \
attrs.get((ns_uri, "attr"), 25) == 25 and \
attrs.items() == [] and \
Index: test_socket.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** test_socket.py 2000/06/29 17:00:54 1.14
--- test_socket.py 2000/12/12 23:11:42 1.15
***************
*** 138,142 ****
s.send(msg)
data = s.recv(1024)
! if msg <> data:
print 'parent/client mismatch'
s.close()
--- 138,142 ----
s.send(msg)
data = s.recv(1024)
! if msg != data:
print 'parent/client mismatch'
s.close()
Index: test_sre.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sre.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** test_sre.py 2000/10/28 19:30:41 1.13
--- test_sre.py 2000/12/12 23:11:42 1.14
***************
*** 48,57 ****
for i in [0, 8, 16, 32, 64, 127, 128, 255]:
! test(r"""sre.match(r"\%03o" % i, chr(i)) != None""", 1)
! test(r"""sre.match(r"\%03o0" % i, chr(i)+"0") != None""", 1)
! test(r"""sre.match(r"\%03o8" % i, chr(i)+"8") != None""", 1)
! test(r"""sre.match(r"\x%02x" % i, chr(i)) != None""", 1)
! test(r"""sre.match(r"\x%02x0" % i, chr(i)+"0") != None""", 1)
! test(r"""sre.match(r"\x%02xz" % i, chr(i)+"z") != None""", 1)
test(r"""sre.match("\911", "")""", None, sre.error)
--- 48,57 ----
for i in [0, 8, 16, 32, 64, 127, 128, 255]:
! test(r"""sre.match(r"\%03o" % i, chr(i)) is not None""", 1)
! test(r"""sre.match(r"\%03o0" % i, chr(i)+"0") is not None""", 1)
! test(r"""sre.match(r"\%03o8" % i, chr(i)+"8") is not None""", 1)
! test(r"""sre.match(r"\x%02x" % i, chr(i)) is not None""", 1)
! test(r"""sre.match(r"\x%02x0" % i, chr(i)+"0") is not None""", 1)
! test(r"""sre.match(r"\x%02xz" % i, chr(i)+"z") is not None""", 1)
test(r"""sre.match("\911", "")""", None, sre.error)
***************
*** 198,206 ****
for i in range(0, 256):
p = p + chr(i)
! test(r"""sre.match(sre.escape(chr(i)), chr(i)) != None""", 1)
test(r"""sre.match(sre.escape(chr(i)), chr(i)).span()""", (0,1))
pat = sre.compile(sre.escape(p))
! test(r"""pat.match(p) != None""", 1)
test(r"""pat.match(p).span()""", (0,256))
--- 198,206 ----
for i in range(0, 256):
p = p + chr(i)
! test(r"""sre.match(sre.escape(chr(i)), chr(i)) is not None""", 1)
test(r"""sre.match(sre.escape(chr(i)), chr(i)).span()""", (0,1))
pat = sre.compile(sre.escape(p))
! test(r"""pat.match(p) is not None""", 1)
test(r"""pat.match(p).span()""", (0,256))
Index: test_struct.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_struct.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** test_struct.py 2000/10/23 17:22:08 1.6
--- test_struct.py 2000/12/12 23:11:42 1.7
***************
*** 16,20 ****
sz = struct.calcsize('i')
! if sz * 3 <> struct.calcsize('iii'):
raise TestFailed, 'inconsistent sizes'
--- 16,20 ----
sz = struct.calcsize('i')
! if sz * 3 != struct.calcsize('iii'):
raise TestFailed, 'inconsistent sizes'
***************
*** 23,27 ****
sz = struct.calcsize(fmt)
sz3 = struct.calcsize(fmt3)
! if sz * 3 <> sz3:
raise TestFailed, 'inconsistent sizes (3*%s -> 3*%d = %d, %s -> %d)' % (
`fmt`, sz, 3*sz, `fmt3`, sz3)
--- 23,27 ----
sz = struct.calcsize(fmt)
sz3 = struct.calcsize(fmt3)
! if sz * 3 != sz3:
raise TestFailed, 'inconsistent sizes (3*%s -> 3*%d = %d, %s -> %d)' % (
`fmt`, sz, 3*sz, `fmt3`, sz3)
***************
*** 50,55 ****
s = struct.pack(format, c, b, h, i, l, f, d)
cp, bp, hp, ip, lp, fp, dp = struct.unpack(format, s)
! if (cp <> c or bp <> b or hp <> h or ip <> i or lp <> l or
! int(100 * fp) <> int(100 * f) or int(100 * dp) <> int(100 * d)):
# ^^^ calculate only to two decimal places
raise TestFailed, "unpack/pack not transitive (%s, %s)" % (
--- 50,55 ----
s = struct.pack(format, c, b, h, i, l, f, d)
cp, bp, hp, ip, lp, fp, dp = struct.unpack(format, s)
! if (cp != c or bp != b or hp != h or ip != i or lp != l or
! int(100 * fp) != int(100 * f) or int(100 * dp) != int(100 * d)):
# ^^^ calculate only to two decimal places
raise TestFailed, "unpack/pack not transitive (%s, %s)" % (
Index: test_support.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** test_support.py 2000/10/23 17:22:08 1.8
--- test_support.py 2000/12/12 23:11:42 1.9
***************
*** 53,57 ****
for i in range(min(len(x), len(y))):
outcome = fcmp(x[i], y[i])
! if outcome <> 0:
return outcome
return cmp(len(x), len(y))
--- 53,57 ----
for i in range(min(len(x), len(y))):
outcome = fcmp(x[i], y[i])
! if outcome != 0:
return outcome
return cmp(len(x), len(y))
Index: test_time.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_time.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** test_time.py 1998/03/26 19:42:56 1.5
--- test_time.py 2000/12/12 23:11:42 1.6
***************
*** 5,14 ****
t = time.time()
time.asctime(time.gmtime(t))
! if time.ctime(t) <> time.asctime(time.localtime(t)):
! print 'time.ctime(t) <> time.asctime(time.localtime(t))'
time.daylight
! if long(time.mktime(time.localtime(t))) <> long(t):
! print 'time.mktime(time.localtime(t)) <> t'
time.sleep(1.2)
--- 5,14 ----
t = time.time()
time.asctime(time.gmtime(t))
! if time.ctime(t) != time.asctime(time.localtime(t)):
! print 'time.ctime(t) != time.asctime(time.localtime(t))'
time.daylight
! if long(time.mktime(time.localtime(t))) != long(t):
! print 'time.mktime(time.localtime(t)) != t'
time.sleep(1.2)
Index: test_types.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** test_types.py 2000/12/12 22:02:59 1.18
--- test_types.py 2000/12/12 23:11:42 1.19
***************
*** 37,45 ****
print '6.3 Comparisons'
! if 0 < 1 <= 1 == 1 >= 1 > 0 <> 1: pass
else: raise TestFailed, 'int comparisons failed'
! if 0L < 1L <= 1L == 1L >= 1L > 0L <> 1L: pass
else: raise TestFailed, 'long int comparisons failed'
! if 0.0 < 1.0 <= 1.0 == 1.0 >= 1.0 > 0.0 <> 1.0: pass
else: raise TestFailed, 'float comparisons failed'
if '' < 'a' <= 'a' == 'a' < 'abc' < 'abd' < 'b': pass
--- 37,45 ----
print '6.3 Comparisons'
! if 0 < 1 <= 1 == 1 >= 1 > 0 != 1: pass
else: raise TestFailed, 'int comparisons failed'
! if 0L < 1L <= 1L == 1L >= 1L > 0L != 1L: pass
else: raise TestFailed, 'long int comparisons failed'
! if 0.0 < 1.0 <= 1.0 == 1.0 >= 1.0 > 0.0 != 1.0: pass
else: raise TestFailed, 'float comparisons failed'
if '' < 'a' <= 'a' == 'a' < 'abc' < 'abd' < 'b': pass
***************
*** 51,57 ****
print '6.4 Numeric types (mostly conversions)'
! if 0 <> 0L or 0 <> 0.0 or 0L <> 0.0: raise TestFailed, 'mixed comparisons'
! if 1 <> 1L or 1 <> 1.0 or 1L <> 1.0: raise TestFailed, 'mixed comparisons'
! if -1 <> -1L or -1 <> -1.0 or -1L <> -1.0:
raise TestFailed, 'int/long/float value not equal'
if int(1.9) == 1 == int(1.1) and int(-1.1) == -1 == int(-1.9): pass
--- 51,57 ----
print '6.4 Numeric types (mostly conversions)'
! if 0 != 0L or 0 != 0.0 or 0L != 0.0: raise TestFailed, 'mixed comparisons'
! if 1 != 1L or 1 != 1.0 or 1L != 1.0: raise TestFailed, 'mixed comparisons'
! if -1 != -1L or -1 != -1.0 or -1L != -1.0:
raise TestFailed, 'int/long/float value not equal'
if int(1.9) == 1 == int(1.1) and int(-1.1) == -1 == int(-1.9): pass
***************
*** 62,69 ****
else: raise TestFailed, 'float() does not work properly'
print '6.4.1 32-bit integers'
! if 12 + 24 <> 36: raise TestFailed, 'int op'
! if 12 + (-24) <> -12: raise TestFailed, 'int op'
! if (-12) + 24 <> 12: raise TestFailed, 'int op'
! if (-12) + (-24) <> -36: raise TestFailed, 'int op'
if not 12 < 24: raise TestFailed, 'int op'
if not -24 < -12: raise TestFailed, 'int op'
--- 62,69 ----
else: raise TestFailed, 'float() does not work properly'
print '6.4.1 32-bit integers'
! if 12 + 24 != 36: raise TestFailed, 'int op'
! if 12 + (-24) != -12: raise TestFailed, 'int op'
! if (-12) + 24 != 12: raise TestFailed, 'int op'
! if (-12) + (-24) != -36: raise TestFailed, 'int op'
if not 12 < 24: raise TestFailed, 'int op'
if not -24 < -12: raise TestFailed, 'int op'
***************
*** 73,80 ****
raise TestFailed, 'int mul commutativity'
print '6.4.2 Long integers'
! if 12L + 24L <> 36L: raise TestFailed, 'long op'
! if 12L + (-24L) <> -12L: raise TestFailed, 'long op'
! if (-12L) + 24L <> 12L: raise TestFailed, 'long op'
! if (-12L) + (-24L) <> -36L: raise TestFailed, 'long op'
if not 12L < 24L: raise TestFailed, 'long op'
if not -24L < -12L: raise TestFailed, 'long op'
--- 73,80 ----
raise TestFailed, 'int mul commutativity'
print '6.4.2 Long integers'
! if 12L + 24L != 36L: raise TestFailed, 'long op'
! if 12L + (-24L) != -12L: raise TestFailed, 'long op'
! if (-12L) + 24L != 12L: raise TestFailed, 'long op'
! if (-12L) + (-24L) != -36L: raise TestFailed, 'long op'
if not 12L < 24L: raise TestFailed, 'long op'
if not -24L < -12L: raise TestFailed, 'long op'
***************
*** 92,99 ****
else:raise TestFailed, 'long op'
print '6.4.3 Floating point numbers'
! if 12.0 + 24.0 <> 36.0: raise TestFailed, 'float op'
! if 12.0 + (-24.0) <> -12.0: raise TestFailed, 'float op'
! if (-12.0) + 24.0 <> 12.0: raise TestFailed, 'float op'
! if (-12.0) + (-24.0) <> -36.0: raise TestFailed, 'float op'
if not 12.0 < 24.0: raise TestFailed, 'float op'
if not -24.0 < -12.0: raise TestFailed, 'float op'
--- 92,99 ----
else:raise TestFailed, 'long op'
print '6.4.3 Floating point numbers'
! if 12.0 + 24.0 != 36.0: raise TestFailed, 'float op'
! if 12.0 + (-24.0) != -12.0: raise TestFailed, 'float op'
! if (-12.0) + 24.0 != 12.0: raise TestFailed, 'float op'
! if (-12.0) + (-24.0) != -36.0: raise TestFailed, 'float op'
if not 12.0 < 24.0: raise TestFailed, 'float op'
if not -24.0 < -12.0: raise TestFailed, 'float op'
***************
*** 102,112 ****
print '6.5.1 Strings'
! if len('') <> 0: raise TestFailed, 'len(\'\')'
! if len('a') <> 1: raise TestFailed, 'len(\'a\')'
! if len('abcdef') <> 6: raise TestFailed, 'len(\'abcdef\')'
! if 'xyz' + 'abcde' <> 'xyzabcde': raise TestFailed, 'string concatenation'
! if 'xyz'*3 <> 'xyzxyzxyz': raise TestFailed, 'string repetition *3'
! if 0*'abcde' <> '': raise TestFailed, 'string repetition 0*'
! if min('abc') <> 'a' or max('abc') <> 'c': raise TestFailed, 'min/max string'
if 'a' in 'abc' and 'b' in 'abc' and 'c' in 'abc' and 'd' not in 'abc': pass
else: raise TestFailed, 'in/not in string'
--- 102,112 ----
print '6.5.1 Strings'
! if len('') != 0: raise TestFailed, 'len(\'\')'
! if len('a') != 1: raise TestFailed, 'len(\'a\')'
! if len('abcdef') != 6: raise TestFailed, 'len(\'abcdef\')'
! if 'xyz' + 'abcde' != 'xyzabcde': raise TestFailed, 'string concatenation'
! if 'xyz'*3 != 'xyzxyzxyz': raise TestFailed, 'string repetition *3'
! if 0*'abcde' != '': raise TestFailed, 'string repetition 0*'
! if min('abc') != 'a' or max('abc') != 'c': raise TestFailed, 'min/max string'
if 'a' in 'abc' and 'b' in 'abc' and 'c' in 'abc' and 'd' not in 'abc': pass
else: raise TestFailed, 'in/not in string'
***************
*** 115,138 ****
print '6.5.2 Tuples'
! if len(()) <> 0: raise TestFailed, 'len(())'
! if len((1,)) <> 1: raise TestFailed, 'len((1,))'
! if len((1,2,3,4,5,6)) <> 6: raise TestFailed, 'len((1,2,3,4,5,6))'
! if (1,2)+(3,4) <> (1,2,3,4): raise TestFailed, 'tuple concatenation'
! if (1,2)*3 <> (1,2,1,2,1,2): raise TestFailed, 'tuple repetition *3'
! if 0*(1,2,3) <> (): raise TestFailed, 'tuple repetition 0*'
! if min((1,2)) <> 1 or max((1,2)) <> 2: raise TestFailed, 'min/max tuple'
if 0 in (0,1,2) and 1 in (0,1,2) and 2 in (0,1,2) and 3 not in (0,1,2): pass
else: raise TestFailed, 'in/not in tuple'
print '6.5.3 Lists'
! if len([]) <> 0: raise TestFailed, 'len([])'
! if len([1,]) <> 1: raise TestFailed, 'len([1,])'
! if len([1,2,3,4,5,6]) <> 6: raise TestFailed, 'len([1,2,3,4,5,6])'
! if [1,2]+[3,4] <> [1,2,3,4]: raise TestFailed, 'list concatenation'
! if [1,2]*3 <> [1,2,1,2,1,2]: raise TestFailed, 'list repetition *3'
! if [1,2]*3L <> [1,2,1,2,1,2]: raise TestFailed, 'list repetition *3L'
! if 0*[1,2,3] <> []: raise TestFailed, 'list repetition 0*'
! if 0L*[1,2,3] <> []: raise TestFailed, 'list repetition 0L*'
! if min([1,2]) <> 1 or max([1,2]) <> 2: raise TestFailed, 'min/max list'
if 0 in [0,1,2] and 1 in [0,1,2] and 2 in [0,1,2] and 3 not in [0,1,2]: pass
else: raise TestFailed, 'in/not in list'
--- 115,138 ----
print '6.5.2 Tuples'
! if len(()) != 0: raise TestFailed, 'len(())'
! if len((1,)) != 1: raise TestFailed, 'len((1,))'
! if len((1,2,3,4,5,6)) != 6: raise TestFailed, 'len((1,2,3,4,5,6))'
! if (1,2)+(3,4) != (1,2,3,4): raise TestFailed, 'tuple concatenation'
! if (1,2)*3 != (1,2,1,2,1,2): raise TestFailed, 'tuple repetition *3'
! if 0*(1,2,3) != (): raise TestFailed, 'tuple repetition 0*'
! if min((1,2)) != 1 or max((1,2)) != 2: raise TestFailed, 'min/max tuple'
if 0 in (0,1,2) and 1 in (0,1,2) and 2 in (0,1,2) and 3 not in (0,1,2): pass
else: raise TestFailed, 'in/not in tuple'
print '6.5.3 Lists'
! if len([]) != 0: raise TestFailed, 'len([])'
! if len([1,]) != 1: raise TestFailed, 'len([1,])'
! if len([1,2,3,4,5,6]) != 6: raise TestFailed, 'len([1,2,3,4,5,6])'
! if [1,2]+[3,4] != [1,2,3,4]: raise TestFailed, 'list concatenation'
! if [1,2]*3 != [1,2,1,2,1,2]: raise TestFailed, 'list repetition *3'
! if [1,2]*3L != [1,2,1,2,1,2]: raise TestFailed, 'list repetition *3L'
! if 0*[1,2,3] != []: raise TestFailed, 'list repetition 0*'
! if 0L*[1,2,3] != []: raise TestFailed, 'list repetition 0L*'
! if min([1,2]) != 1 or max([1,2]) != 2: raise TestFailed, 'min/max list'
if 0 in [0,1,2] and 1 in [0,1,2] and 2 in [0,1,2] and 3 not in [0,1,2]: pass
else: raise TestFailed, 'in/not in list'
***************
*** 156,208 ****
a[1L] = 2
a[2L] = 3
! if a <> [1,2,3,3,4]: raise TestFailed, 'list item assignment [0L], [1L], [2L]'
a[0] = 5
a[1] = 6
a[2] = 7
! if a <> [5,6,7,3,4]: raise TestFailed, 'list item assignment [0], [1], [2]'
a[-2L] = 88
a[-1L] = 99
! if a <> [5,6,7,88,99]: raise TestFailed, 'list item assignment [-2L], [-1L]'
a[-2] = 8
a[-1] = 9
! if a <> [5,6,7,8,9]: raise TestFailed, 'list item assignment [-2], [-1]'
a[:2] = [0,4]
a[-3:] = []
a[1:1] = [1,2,3]
! if a <> [0,1,2,3,4]: raise TestFailed, 'list slice assignment'
a[ 1L : 4L] = [7,8,9]
! if a <> [0,7,8,9,4]: raise TestFailed, 'list slice assignment using long ints'
del a[1:4]
! if a <> [0,4]: raise TestFailed, 'list slice deletion'
del a[0]
! if a <> [4]: raise TestFailed, 'list item deletion [0]'
del a[-1]
! if a <> []: raise TestFailed, 'list item deletion [-1]'
a=range(0,5)
del a[1L:4L]
! if a <> [0,4]: raise TestFailed, 'list slice deletion'
del a[0L]
! if a <> [4]: raise TestFailed, 'list item deletion [0]'
del a[-1L]
! if a <> []: raise TestFailed, 'list item deletion [-1]'
a.append(0)
a.append(1)
a.append(2)
! if a <> [0,1,2]: raise TestFailed, 'list append'
a.insert(0, -2)
a.insert(1, -1)
a.insert(2,0)
! if a <> [-2,-1,0,0,1,2]: raise TestFailed, 'list insert'
! if a.count(0) <> 2: raise TestFailed, ' list count'
! if a.index(0) <> 2: raise TestFailed, 'list index'
a.remove(0)
! if a <> [-2,-1,0,1,2]: raise TestFailed, 'list remove'
a.reverse()
! if a <> [2,1,0,-1,-2]: raise TestFailed, 'list reverse'
a.sort()
! if a <> [-2,-1,0,1,2]: raise TestFailed, 'list sort'
def revcmp(a, b): return cmp(b, a)
a.sort(revcmp)
! if a <> [2,1,0,-1,-2]: raise TestFailed, 'list sort with cmp func'
# The following dumps core in unpatched Python 1.5:
def myComparison(x,y):
--- 156,208 ----
a[1L] = 2
a[2L] = 3
! if a != [1,2,3,3,4]: raise TestFailed, 'list item assignment [0L], [1L], [2L]'
a[0] = 5
a[1] = 6
a[2] = 7
! if a != [5,6,7,3,4]: raise TestFailed, 'list item assignment [0], [1], [2]'
a[-2L] = 88
a[-1L] = 99
! if a != [5,6,7,88,99]: raise TestFailed, 'list item assignment [-2L], [-1L]'
a[-2] = 8
a[-1] = 9
! if a != [5,6,7,8,9]: raise TestFailed, 'list item assignment [-2], [-1]'
a[:2] = [0,4]
a[-3:] = []
a[1:1] = [1,2,3]
! if a != [0,1,2,3,4]: raise TestFailed, 'list slice assignment'
a[ 1L : 4L] = [7,8,9]
! if a != [0,7,8,9,4]: raise TestFailed, 'list slice assignment using long ints'
del a[1:4]
! if a != [0,4]: raise TestFailed, 'list slice deletion'
del a[0]
! if a != [4]: raise TestFailed, 'list item deletion [0]'
del a[-1]
! if a != []: raise TestFailed, 'list item deletion [-1]'
a=range(0,5)
del a[1L:4L]
! if a != [0,4]: raise TestFailed, 'list slice deletion'
del a[0L]
! if a != [4]: raise TestFailed, 'list item deletion [0]'
del a[-1L]
! if a != []: raise TestFailed, 'list item deletion [-1]'
a.append(0)
a.append(1)
a.append(2)
! if a != [0,1,2]: raise TestFailed, 'list append'
a.insert(0, -2)
a.insert(1, -1)
a.insert(2,0)
! if a != [-2,-1,0,0,1,2]: raise TestFailed, 'list insert'
! if a.count(0) != 2: raise TestFailed, ' list count'
! if a.index(0) != 2: raise TestFailed, 'list index'
a.remove(0)
! if a != [-2,-1,0,1,2]: raise TestFailed, 'list remove'
a.reverse()
! if a != [2,1,0,-1,-2]: raise TestFailed, 'list reverse'
a.sort()
! if a != [-2,-1,0,1,2]: raise TestFailed, 'list sort'
def revcmp(a, b): return cmp(b, a)
a.sort(revcmp)
! if a != [2,1,0,-1,-2]: raise TestFailed, 'list sort with cmp func'
# The following dumps core in unpatched Python 1.5:
def myComparison(x,y):
***************
*** 220,239 ****
print '6.6 Mappings == Dictionaries'
d = {}
! if d.keys() <> []: raise TestFailed, '{}.keys()'
! if d.has_key('a') <> 0: raise TestFailed, '{}.has_key(\'a\')'
! if len(d) <> 0: raise TestFailed, 'len({})'
d = {'a': 1, 'b': 2}
! if len(d) <> 2: raise TestFailed, 'len(dict)'
k = d.keys()
k.sort()
! if k <> ['a', 'b']: raise TestFailed, 'dict keys()'
if d.has_key('a') and d.has_key('b') and not d.has_key('c'): pass
else: raise TestFailed, 'dict keys()'
! if d['a'] <> 1 or d['b'] <> 2: raise TestFailed, 'dict item'
d['c'] = 3
d['a'] = 4
! if d['c'] <> 3 or d['a'] <> 4: raise TestFailed, 'dict item assignment'
del d['b']
! if d <> {'a': 4, 'c': 3}: raise TestFailed, 'dict item deletion'
d = {1:1, 2:2, 3:3}
d.clear()
--- 220,239 ----
print '6.6 Mappings == Dictionaries'
d = {}
! if d.keys() != []: raise TestFailed, '{}.keys()'
! if d.has_key('a') != 0: raise TestFailed, '{}.has_key(\'a\')'
! if len(d) != 0: raise TestFailed, 'len({})'
d = {'a': 1, 'b': 2}
! if len(d) != 2: raise TestFailed, 'len(dict)'
k = d.keys()
k.sort()
! if k != ['a', 'b']: raise TestFailed, 'dict keys()'
if d.has_key('a') and d.has_key('b') and not d.has_key('c'): pass
else: raise TestFailed, 'dict keys()'
! if d['a'] != 1 or d['b'] != 2: raise TestFailed, 'dict item'
d['c'] = 3
d['a'] = 4
! if d['c'] != 3 or d['a'] != 4: raise TestFailed, 'dict item assignment'
del d['b']
! if d != {'a': 4, 'c': 3}: raise TestFailed, 'dict item deletion'
d = {1:1, 2:2, 3:3}
d.clear()
***************
*** 247,254 ****
# dict.get()
d = {}
! if d.get('c') != None: raise TestFailed, 'missing {} get, no 2nd arg'
if d.get('c', 3) != 3: raise TestFailed, 'missing {} get, w/ 2nd arg'
d = {'a' : 1, 'b' : 2}
! if d.get('c') != None: raise TestFailed, 'missing dict get, no 2nd arg'
if d.get('c', 3) != 3: raise TestFailed, 'missing dict get, w/ 2nd arg'
if d.get('a') != 1: raise TestFailed, 'present dict get, no 2nd arg'
--- 247,254 ----
# dict.get()
d = {}
! if d.get('c') is not None: raise TestFailed, 'missing {} get, no 2nd arg'
if d.get('c', 3) != 3: raise TestFailed, 'missing {} get, w/ 2nd arg'
d = {'a' : 1, 'b' : 2}
! if d.get('c') is not None: raise TestFailed, 'missing dict get, no 2nd arg'
if d.get('c', 3) != 3: raise TestFailed, 'missing dict get, w/ 2nd arg'
if d.get('a') != 1: raise TestFailed, 'present dict get, no 2nd arg'
***************
*** 256,268 ****
# dict.setdefault()
d = {}
! if d.setdefault('key0') <> None:
raise TestFailed, 'missing {} setdefault, no 2nd arg'
! if d.setdefault('key0') <> None:
raise TestFailed, 'present {} setdefault, no 2nd arg'
d.setdefault('key', []).append(3)
! if d['key'][0] <> 3:
raise TestFailed, 'missing {} setdefault, w/ 2nd arg'
d.setdefault('key', []).append(4)
! if len(d['key']) <> 2:
raise TestFailed, 'present {} setdefault, w/ 2nd arg'
# dict.popitem()
--- 256,268 ----
# dict.setdefault()
d = {}
! if d.setdefault('key0') is not None:
raise TestFailed, 'missing {} setdefault, no 2nd arg'
! if d.setdefault('key0') is not None:
raise TestFailed, 'present {} setdefault, no 2nd arg'
d.setdefault('key', []).append(3)
! if d['key'][0] != 3:
raise TestFailed, 'missing {} setdefault, w/ 2nd arg'
d.setdefault('key', []).append(4)
! if len(d['key']) != 2:
raise TestFailed, 'present {} setdefault, w/ 2nd arg'
# dict.popitem()
Index: test_unpack.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unpack.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_unpack.py 2000/10/12 14:45:58 1.4
--- test_unpack.py 2000/12/12 23:11:42 1.5
***************
*** 17,21 ****
print 'unpack tuple'
a, b, c = t
! if a <> 1 or b <> 2 or c <> 3:
raise TestFailed
--- 17,21 ----
print 'unpack tuple'
a, b, c = t
! if a != 1 or b != 2 or c != 3:
raise TestFailed
***************
*** 24,28 ****
print 'unpack list'
a, b, c = l
! if a <> 4 or b <> 5 or c <> 6:
raise TestFailed
--- 24,28 ----
print 'unpack list'
a, b, c = l
! if a != 4 or b != 5 or c != 6:
raise TestFailed
***************
*** 31,35 ****
print 'unpack implied tuple'
a, b, c = 7, 8, 9
! if a <> 7 or b <> 8 or c <> 9:
raise TestFailed
--- 31,35 ----
print 'unpack implied tuple'
a, b, c = 7, 8, 9
! if a != 7 or b != 8 or c != 9:
raise TestFailed
***************
*** 38,42 ****
print 'unpack string'
a, b, c = 'one'
! if a <> 'o' or b <> 'n' or c <> 'e':
raise TestFailed
--- 38,42 ----
print 'unpack string'
a, b, c = 'one'
! if a != 'o' or b != 'n' or c != 'e':
raise TestFailed
***************
*** 45,49 ****
print 'unpack sequence'
a, b, c = Seq()
! if a <> 0 or b <> 1 or c <> 2:
raise TestFailed
--- 45,49 ----
print 'unpack sequence'
a, b, c = Seq()
! if a != 0 or b != 1 or c != 2:
raise TestFailed
***************
*** 54,61 ****
sl = [100]
a, = st
! if a <> 99:
raise TestFailed
b, = sl
! if b <> 100:
raise TestFailed
--- 54,61 ----
sl = [100]
a, = st
! if a != 99:
raise TestFailed
b, = sl
! if b != 100:
raise TestFailed
- Previous message: [Python-checkins] CVS: python/dist/src/Lib/plat-irix6 FL.py,1.1,1.2 cdplayer.py,1.3,1.4 flp.py,1.6,1.7 jpeg.py,1.3,1.4 panel.py,1.2,1.3 panelparser.py,1.1,1.2 readcd.py,1.2,1.3 torgb.py,1.2,1.3
- Next message: [Python-checkins] CVS: python/dist/src/Lib StringIO.py,1.12,1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]