[Python-checkins] CVS: python/dist/src/Lib/test test_al.py,1.4,1.5 test_array.py,1.11,1.12 test_atexit.py,1.1,1.2 test_audioop.py,1.7,1.8 test_b2.py,1.22,1.23 test_binascii.py,1.7,1.8 test_binhex.py,1.8,1.9 test_bsddb.py,1.5,1.6 test_bufio.py,1.2,1.3 test_cd.py,1.3,1.4 test_cgi.py,1.5,1.6 test_cl.py,1.3,1.4 test_cmath.py,1.4,1.5 test_compile.py,1.1,1.2 test_cookie.py,1.4,1.5 test_crypt.py,1.4,1.5 test_dbm.py,1.4,1.5 test_dl.py,1.8,1.9 test_errno.py,1.5,1.6 test_extcall.py,1.9,1.10 test_fcntl.py,1.13,1.14 test_file.py,1.2,1.3 test_fork1.py,1.6,1.7 test_format.py,1.5,1.6 test_gc.py,1.6,1.7 test_gdbm.py,1.5,1.6 test_getopt.py,1.3,1.4 test_gl.py,1.5,1.6 test_grammar.py,1.21,1.22 test_grp.py,1.5,1.6 test_gzip.py,1.4,1.5 test_imageop.py,1.9,1.10 test_imgfile.py,1.7,1.8 test_long.py,1.5,1.6 test_minidom.py,1.19,1.20 test_mmap.py,1.13,1.14 test_new.py,1.6,1.7 test_nis.py,1.9,1.10 test_openpty.py,1.4,1.5 test_parser.py,1.4,1.5 test_pkg.py,1.10,1.11 test_poll.py,1.4,1.5 test_pty.py,1.7,1.8 test_pwd.py,1.8,1.9 test_re.py,1.27,1.28 test_regex.py,1.7,1.8 test_rfc822.py,1.7,1.8 test_rgbimg.py,1.10,1.11 test_sax.py,1.14,1.15 test_select.py,1.11,1.12 test_signal.py,1.6,1.7 test_socket.py,1.15,1.16 test_sre.py,1.18,1.19 test_strftime.py,1.21,1.22 test_string.py,1.12,1.13 test_strop.py,1.8,1.9 test_sunaudiodev.py,1.7,1.8 test_support.py,1.9,1.10 test_thread.py,1.7,1.8 test_timing.py,1.1,1.2 test_tokenize.py,1.3,1.4 test_ucn.py,1.2,1.3 test_unicode.py,1.26,1.27 test_unicodedata.py,1.4,1.5 test_urllib.py,1.3,1.4 test_userdict.py,1.1,1.2 test_userlist.py,1.3,1.4 test_userstring.py,1.2,1.3 test_winreg.py,1.7,1.8 test_xmllib.py,1.2,1.3
M.-A. Lemburg
lemburg@users.sourceforge.net
Wed, 17 Jan 2001 11:11:16 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv1883/Lib/test
Modified Files:
test_al.py test_array.py test_atexit.py test_audioop.py
test_b2.py test_binascii.py test_binhex.py test_bsddb.py
test_bufio.py test_cd.py test_cgi.py test_cl.py test_cmath.py
test_compile.py test_cookie.py test_crypt.py test_dbm.py
test_dl.py test_errno.py test_extcall.py test_fcntl.py
test_file.py test_fork1.py test_format.py test_gc.py
test_gdbm.py test_getopt.py test_gl.py test_grammar.py
test_grp.py test_gzip.py test_imageop.py test_imgfile.py
test_long.py test_minidom.py test_mmap.py test_new.py
test_nis.py test_openpty.py test_parser.py test_pkg.py
test_poll.py test_pty.py test_pwd.py test_re.py test_regex.py
test_rfc822.py test_rgbimg.py test_sax.py test_select.py
test_signal.py test_socket.py test_sre.py test_strftime.py
test_string.py test_strop.py test_sunaudiodev.py
test_support.py test_thread.py test_timing.py test_tokenize.py
test_ucn.py test_unicode.py test_unicodedata.py test_urllib.py
test_userdict.py test_userlist.py test_userstring.py
test_winreg.py test_xmllib.py
Log Message:
This patch removes all uses of "assert" in the regression test suite
and replaces them with a new API verify(). As a result the regression
suite will also perform its tests in optimization mode.
Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
Index: test_al.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_al.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_al.py 2000/10/23 17:22:07 1.4
--- test_al.py 2001/01/17 19:11:13 1.5
***************
*** 4,8 ****
"""
import al
! from test_support import verbose
alattrs = ['__doc__', '__name__', 'getdefault', 'getminmax', 'getname', 'getparams',
--- 4,8 ----
"""
import al
! from test_support import verify, verbose
alattrs = ['__doc__', '__name__', 'getdefault', 'getminmax', 'getname', 'getparams',
Index: test_array.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_array.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** test_array.py 2000/11/14 21:36:07 1.11
--- test_array.py 2001/01/17 19:11:13 1.12
***************
*** 4,8 ****
"""
import array
! from test_support import verbose, TESTFN, unlink, TestFailed
def main():
--- 4,8 ----
"""
import array
! from test_support import verify, verbose, TESTFN, unlink, TestFailed
def main():
Index: test_atexit.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_atexit.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** test_atexit.py 2000/06/28 15:07:31 1.1
--- test_atexit.py 2001/01/17 19:11:13 1.2
***************
*** 1,4 ****
# Test the exit module
! from test_support import verbose
import atexit
--- 1,4 ----
# Test the exit module
! from test_support import verify, verbose
import atexit
Index: test_audioop.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_audioop.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** test_audioop.py 2000/12/12 23:11:42 1.7
--- test_audioop.py 2001/01/17 19:11:13 1.8
***************
*** 1,5 ****
# Test audioop.
import audioop
! from test_support import verbose
def gendata1():
--- 1,5 ----
# Test audioop.
import audioop
! from test_support import verify, verbose
def gendata1():
Index: test_b2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b2.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** test_b2.py 2001/01/17 17:09:53 1.22
--- test_b2.py 2001/01/17 19:11:13 1.23
***************
*** 268,272 ****
# regression tests for SourceForge bug #121695
def _range_test(r):
! assert r.start != r.stop, 'Test not valid for passed-in xrange object.'
if r.stop in r:
raise TestFailed, 'r.stop in ' + `r`
--- 268,272 ----
# regression tests for SourceForge bug #121695
def _range_test(r):
! verify(r.start != r.stop, 'Test not valid for passed-in xrange object.')
if r.stop in r:
raise TestFailed, 'r.stop in ' + `r`
Index: test_binascii.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binascii.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** test_binascii.py 2000/12/12 23:11:42 1.7
--- test_binascii.py 2001/01/17 19:11:13 1.8
***************
*** 1,5 ****
"""Test the binascii C module."""
! from test_support import verbose
import binascii
--- 1,5 ----
"""Test the binascii C module."""
! from test_support import verify, verbose
import binascii
***************
*** 43,47 ****
b = binascii.a2b_base64(line)
res = res + b
! assert res == testdata
# Test base64 with random invalid characters sprinkled throughout
--- 43,47 ----
b = binascii.a2b_base64(line)
res = res + b
! verify(res == testdata)
# Test base64 with random invalid characters sprinkled throughout
***************
*** 68,72 ****
b = binascii.a2b_base64(line)
res = res + b
! assert res == testdata
# Test uu
--- 68,72 ----
b = binascii.a2b_base64(line)
res = res + b
! verify(res == testdata)
# Test uu
***************
*** 83,87 ****
b = binascii.a2b_uu(line)
res = res + b
! assert res == testdata
# Test crc32()
--- 83,87 ----
b = binascii.a2b_uu(line)
res = res + b
! verify(res == testdata)
# Test crc32()
Index: test_binhex.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binhex.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** test_binhex.py 2001/01/17 18:59:46 1.8
--- test_binhex.py 2001/01/17 19:11:13 1.9
***************
*** 7,11 ****
import binhex
import tempfile
! from test_support import verbose, TestSkipped
def test():
--- 7,11 ----
import binhex
import tempfile
! from test_support import verify, verbose, TestSkipped
def test():
Index: test_bsddb.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bsddb.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** test_bsddb.py 2000/12/12 23:11:42 1.5
--- test_bsddb.py 2001/01/17 19:11:13 1.6
***************
*** 7,11 ****
import bsddb
import tempfile
! from test_support import verbose
def test(openmethod, what):
--- 7,11 ----
import bsddb
import tempfile
! from test_support import verify, verbose
def test(openmethod, what):
Index: test_bufio.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bufio.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** test_bufio.py 2001/01/08 01:17:26 1.2
--- test_bufio.py 2001/01/17 19:11:13 1.3
***************
*** 14,18 ****
q, r = divmod(length, len(pattern))
teststring = pattern * q + pattern[:r]
! assert len(teststring) == length
try_one(teststring)
try_one(teststring + "x")
--- 14,18 ----
q, r = divmod(length, len(pattern))
teststring = pattern * q + pattern[:r]
! verify(len(teststring) == length)
try_one(teststring)
try_one(teststring + "x")
Index: test_cd.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cd.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** test_cd.py 2000/06/28 14:48:01 1.3
--- test_cd.py 2001/01/17 19:11:13 1.4
***************
*** 4,8 ****
"""
import cd
! from test_support import verbose
cdattrs = ['BLOCKSIZE', 'CDROM', 'DATASIZE', 'ERROR', 'NODISC', 'PAUSED', 'PLAYING', 'READY',
--- 4,8 ----
"""
import cd
! from test_support import verify, verbose
cdattrs = ['BLOCKSIZE', 'CDROM', 'DATASIZE', 'ERROR', 'NODISC', 'PAUSED', 'PLAYING', 'READY',
Index: test_cgi.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cgi.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** test_cgi.py 2001/01/17 15:08:37 1.5
--- test_cgi.py 2001/01/17 19:11:13 1.6
***************
*** 1,2 ****
--- 1,3 ----
+ from test_support import verify, verbose
import cgi
import os
***************
*** 118,124 ****
print repr(orig)
d = do_test(orig, "GET")
! assert d == expect, "Error parsing %s" % repr(orig)
d = do_test(orig, "POST")
! assert d == expect, "Error parsing %s" % repr(orig)
env = {'QUERY_STRING': orig}
--- 119,125 ----
print repr(orig)
d = do_test(orig, "GET")
! verify(d == expect, "Error parsing %s" % repr(orig))
d = do_test(orig, "POST")
! verify(d == expect, "Error parsing %s" % repr(orig))
env = {'QUERY_STRING': orig}
***************
*** 128,146 ****
if type(expect) == type({}):
# test dict interface
! assert len(expect) == len(fcd)
! assert norm(expect.keys()) == norm(fcd.keys())
! assert norm(expect.values()) == norm(fcd.values())
! assert norm(expect.items()) == norm(fcd.items())
! assert fcd.get("nonexistent field", "default") == "default"
! assert len(sd) == len(fs)
! assert norm(sd.keys()) == norm(fs.keys())
! assert fs.getvalue("nonexistent field", "default") == "default"
# test individual fields
for key in expect.keys():
expect_val = expect[key]
! assert fcd.has_key(key)
! assert norm(fcd[key]) == norm(expect[key])
! assert fcd.get(key, "default") == fcd[key]
! assert fs.has_key(key)
if len(expect_val) > 1:
single_value = 0
--- 129,147 ----
if type(expect) == type({}):
# test dict interface
! verify(len(expect) == len(fcd))
! verify(norm(expect.keys()) == norm(fcd.keys()))
! verify(norm(expect.values()) == norm(fcd.values()))
! verify(norm(expect.items()) == norm(fcd.items()))
! verify(fcd.get("nonexistent field", "default") == "default")
! verify(len(sd) == len(fs))
! verify(norm(sd.keys()) == norm(fs.keys()))
! verify(fs.getvalue("nonexistent field", "default") == "default")
# test individual fields
for key in expect.keys():
expect_val = expect[key]
! verify(fcd.has_key(key))
! verify(norm(fcd[key]) == norm(expect[key]))
! verify(fcd.get(key, "default") == fcd[key])
! verify(fs.has_key(key))
if len(expect_val) > 1:
single_value = 0
***************
*** 150,165 ****
val = sd[key]
except IndexError:
! assert not single_value
! assert fs.getvalue(key) == expect_val
else:
! assert single_value
! assert val == expect_val[0]
! assert fs.getvalue(key) == expect_val[0]
! assert norm(sd.getlist(key)) == norm(expect_val)
if single_value:
! assert norm(sd.values()) == \
! first_elts(norm(expect.values()))
! assert norm(sd.items()) == \
! first_second_elts(norm(expect.items()))
# Test the weird FormContentDict classes
--- 151,166 ----
val = sd[key]
except IndexError:
! verify(not single_value)
! verify(fs.getvalue(key) == expect_val)
else:
! verify(single_value)
! verify(val == expect_val[0])
! verify(fs.getvalue(key) == expect_val[0])
! verify(norm(sd.getlist(key)) == norm(expect_val))
if single_value:
! verify(norm(sd.values()) == \
! first_elts(norm(expect.values())))
! verify(norm(sd.items()) == \
! first_second_elts(norm(expect.items())))
# Test the weird FormContentDict classes
***************
*** 168,175 ****
d = cgi.InterpFormContentDict(env)
for k, v in expect.items():
! assert d[k] == v
for k, v in d.items():
! assert expect[k] == v
! assert norm(expect.values()) == norm(d.values())
print "Testing log"
--- 169,176 ----
d = cgi.InterpFormContentDict(env)
for k, v in expect.items():
! verify(d[k] == v)
for k, v in d.items():
! verify(expect[k] == v)
! verify(norm(expect.values()) == norm(d.values()))
print "Testing log"
Index: test_cl.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cl.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** test_cl.py 2000/06/28 14:48:01 1.3
--- test_cl.py 2001/01/17 19:11:13 1.4
***************
*** 4,8 ****
"""
import cl
! from test_support import verbose
clattrs = ['ADDED_ALGORITHM_ERROR', 'ALAW', 'ALGORITHM_ID',
--- 4,8 ----
"""
import cl
! from test_support import verify, verbose
clattrs = ['ADDED_ALGORITHM_ERROR', 'ALAW', 'ALGORITHM_ID',
Index: test_cmath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cmath.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_cmath.py 1998/03/26 19:41:54 1.4
--- test_cmath.py 2001/01/17 19:11:13 1.5
***************
*** 4,8 ****
"""
import cmath
! from test_support import verbose
testdict = {'acos' : 1.0,
--- 4,8 ----
"""
import cmath
! from test_support import verify, verbose
testdict = {'acos' : 1.0,
Index: test_compile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_compile.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** test_compile.py 2000/07/25 22:15:44 1.1
--- test_compile.py 2001/01/17 19:11:13 1.2
***************
*** 1,3 ****
! from test_support import verbose, TestFailed
if verbose:
--- 1,3 ----
! from test_support import verify, verbose, TestFailed
if verbose:
Index: test_cookie.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cookie.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_cookie.py 2000/10/23 17:22:07 1.4
--- test_cookie.py 2001/01/17 19:11:13 1.5
***************
*** 17,21 ****
for k, v in dict.items():
print ' ', k, repr( C[k].value ), repr(v)
! assert C[k].value == v
print C[k]
--- 17,21 ----
for k, v in dict.items():
print ' ', k, repr( C[k].value ), repr(v)
! verify(C[k].value == v)
print C[k]
***************
*** 23,29 ****
C.load('Customer="WILE_E_COYOTE"; Version=1; Path=/acme')
! assert C['Customer'].value == 'WILE_E_COYOTE'
! assert C['Customer']['version'] == '1'
! assert C['Customer']['path'] == '/acme'
print C.output(['path'])
--- 23,29 ----
C.load('Customer="WILE_E_COYOTE"; Version=1; Path=/acme')
! verify(C['Customer'].value == 'WILE_E_COYOTE')
! verify(C['Customer']['version'] == '1')
! verify(C['Customer']['path'] == '/acme')
print C.output(['path'])
***************
*** 34,38 ****
C = Cookie.SimpleCookie()
C.load('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"')
! assert C['Customer'].value == 'WILE_E_COYOTE'
! assert C['Customer']['version'] == '1'
! assert C['Customer']['path'] == '/acme'
--- 34,38 ----
C = Cookie.SimpleCookie()
C.load('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"')
! verify(C['Customer'].value == 'WILE_E_COYOTE')
! verify(C['Customer']['version'] == '1')
! verify(C['Customer']['path'] == '/acme')
Index: test_crypt.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_crypt.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_crypt.py 2000/10/23 17:22:07 1.4
--- test_crypt.py 2001/01/17 19:11:13 1.5
***************
*** 4,8 ****
"""
! from test_support import verbose
import crypt
--- 4,8 ----
"""
! from test_support import verify, verbose
import crypt
Index: test_dbm.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dbm.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_dbm.py 2000/09/18 17:56:58 1.4
--- test_dbm.py 2001/01/17 19:11:13 1.5
***************
*** 5,9 ****
import dbm
from dbm import error
! from test_support import verbose
filename = '/tmp/delete_me'
--- 5,9 ----
import dbm
from dbm import error
! from test_support import verify, verbose
filename = '/tmp/delete_me'
Index: test_dl.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dl.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** test_dl.py 2000/08/04 13:34:43 1.8
--- test_dl.py 2001/01/17 19:11:13 1.9
***************
*** 5,9 ****
import dl
! from test_support import verbose,TestSkipped
sharedlibs = [
--- 5,9 ----
import dl
! from test_support import verify, verbose,TestSkipped
sharedlibs = [
Index: test_errno.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_errno.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** test_errno.py 1998/03/26 19:42:02 1.5
--- test_errno.py 2001/01/17 19:11:13 1.6
***************
*** 5,9 ****
import errno
! from test_support import verbose
errors = ['E2BIG', 'EACCES', 'EADDRINUSE', 'EADDRNOTAVAIL', 'EADV',
--- 5,9 ----
import errno
! from test_support import verify, verbose
errors = ['E2BIG', 'EACCES', 'EADDRINUSE', 'EADDRNOTAVAIL', 'EADV',
Index: test_extcall.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_extcall.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** test_extcall.py 2001/01/15 22:14:16 1.9
--- test_extcall.py 2001/01/17 19:11:13 1.10
***************
*** 1,2 ****
--- 1,3 ----
+ from test_support import verify, verbose
from UserList import UserList
from test_support import TestFailed
***************
*** 80,88 ****
d = {'a': 1, 'b': 2, 'c': 3}
d2 = d.copy()
! assert d == d2
g(1, d=4, **d)
print d
print d2
! assert d == d2, "function call modified dictionary"
# what about willful misconduct?
--- 81,89 ----
d = {'a': 1, 'b': 2, 'c': 3}
d2 = d.copy()
! verify(d == d2)
g(1, d=4, **d)
print d
print d2
! verify(d == d2, "function call modified dictionary")
# what about willful misconduct?
***************
*** 92,96 ****
d = {}
kw = saboteur(a=1, **d)
! assert d == {}
# break the cycle
del kw['x']
--- 93,97 ----
d = {}
kw = saboteur(a=1, **d)
! verify(d == {})
# break the cycle
del kw['x']
Index: test_fcntl.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_fcntl.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** test_fcntl.py 2000/10/23 17:22:07 1.13
--- test_fcntl.py 2001/01/17 19:11:13 1.14
***************
*** 7,11 ****
import FCNTL
import os, sys
! from test_support import verbose, TESTFN
filename = TESTFN
--- 7,11 ----
import FCNTL
import os, sys
! from test_support import verify, verbose, TESTFN
filename = TESTFN
Index: test_file.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_file.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** test_file.py 2000/10/23 16:59:35 1.2
--- test_file.py 2001/01/17 19:11:13 1.3
***************
*** 1,5 ****
import os
! from test_support import TESTFN
from UserList import UserList
--- 1,5 ----
import os
! from test_support import verify, TESTFN
from UserList import UserList
***************
*** 12,16 ****
buf = f.read()
f.close()
! assert buf == '12'
# verify writelines with integers
--- 12,16 ----
buf = f.read()
f.close()
! verify(buf == '12')
# verify writelines with integers
Index: test_fork1.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_fork1.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** test_fork1.py 2000/08/15 18:52:33 1.6
--- test_fork1.py 2001/01/17 19:11:13 1.7
***************
*** 13,17 ****
import os, sys, time, thread
! from test_support import TestSkipped
try:
--- 13,17 ----
import os, sys, time, thread
! from test_support import verify, verbose, TestSkipped
try:
***************
*** 52,56 ****
a = alive.keys()
a.sort()
! assert a == range(NUM_THREADS)
prefork_lives = alive.copy()
--- 52,56 ----
a = alive.keys()
a.sort()
! verify(a == range(NUM_THREADS))
prefork_lives = alive.copy()
***************
*** 69,74 ****
# Parent
spid, status = os.waitpid(cpid, 0)
! assert spid == cpid
! assert status == 0, "cause = %d, exit = %d" % (status&0xff, status>>8)
global stop
# Tell threads to die
--- 69,75 ----
# Parent
spid, status = os.waitpid(cpid, 0)
! verify(spid == cpid)
! verify(status == 0,
! "cause = %d, exit = %d" % (status&0xff, status>>8) )
global stop
# Tell threads to die
Index: test_format.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_format.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** test_format.py 2000/12/20 00:55:46 1.5
--- test_format.py 2001/01/17 19:11:13 1.6
***************
*** 1,3 ****
! from test_support import verbose
import string, sys
--- 1,3 ----
! from test_support import verify, verbose
import string, sys
Index: test_gc.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gc.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** test_gc.py 2000/10/23 17:22:07 1.6
--- test_gc.py 2001/01/17 19:11:13 1.7
***************
*** 1,3 ****
! from test_support import verbose, TestFailed
import gc
--- 1,3 ----
! from test_support import verify, verbose, TestFailed
import gc
***************
*** 162,166 ****
enabled = gc.isenabled()
gc.disable()
! assert not gc.isenabled()
debug = gc.get_debug()
gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak
--- 162,166 ----
enabled = gc.isenabled()
gc.disable()
! verify(not gc.isenabled() )
debug = gc.get_debug()
gc.set_debug(debug & ~gc.DEBUG_LEAK) # this test is supposed to leak
***************
*** 175,179 ****
# make sure to always test gc.enable()
gc.enable()
! assert gc.isenabled()
if not enabled:
gc.disable()
--- 175,179 ----
# make sure to always test gc.enable()
gc.enable()
! verify(gc.isenabled())
if not enabled:
gc.disable()
Index: test_gdbm.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gdbm.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** test_gdbm.py 2000/12/18 17:28:05 1.5
--- test_gdbm.py 2001/01/17 19:11:13 1.6
***************
*** 6,10 ****
import gdbm
from gdbm import error
! from test_support import verbose, TestFailed
filename= '/tmp/delete_me'
--- 6,10 ----
import gdbm
from gdbm import error
! from test_support import verify, verbose, TestFailed
filename= '/tmp/delete_me'
Index: test_getopt.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_getopt.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** test_getopt.py 2000/12/27 08:03:20 1.3
--- test_getopt.py 2001/01/17 19:11:13 1.4
***************
*** 4,8 ****
import getopt
from getopt import GetoptError
! from test_support import verbose
def expectException(teststr, expected, failure=AssertionError):
--- 4,8 ----
import getopt
from getopt import GetoptError
! from test_support import verify, verbose
def expectException(teststr, expected, failure=AssertionError):
***************
*** 18,23 ****
if verbose:
print 'Running tests on getopt.short_has_arg'
! assert getopt.short_has_arg('a', 'a:')
! assert not getopt.short_has_arg('a', 'a')
expectException("tmp = getopt.short_has_arg('a', 'b')", GetoptError)
expectException("tmp = getopt.short_has_arg('a', '')", GetoptError)
--- 18,23 ----
if verbose:
print 'Running tests on getopt.short_has_arg'
! verify(getopt.short_has_arg('a', 'a:'))
! verify(not getopt.short_has_arg('a', 'a'))
expectException("tmp = getopt.short_has_arg('a', 'b')", GetoptError)
expectException("tmp = getopt.short_has_arg('a', '')", GetoptError)
***************
*** 26,37 ****
print 'Running tests on getopt.long_has_args'
has_arg, option = getopt.long_has_args('abc', ['abc='])
! assert has_arg
! assert option == 'abc'
has_arg, option = getopt.long_has_args('abc', ['abc'])
! assert not has_arg
! assert option == 'abc'
has_arg, option = getopt.long_has_args('abc', ['abcd'])
! assert not has_arg
! assert option == 'abcd'
expectException("has_arg, option = getopt.long_has_args('abc', ['def'])",
GetoptError)
--- 26,37 ----
print 'Running tests on getopt.long_has_args'
has_arg, option = getopt.long_has_args('abc', ['abc='])
! verify(has_arg)
! verify(option == 'abc')
has_arg, option = getopt.long_has_args('abc', ['abc'])
! verify(not has_arg)
! verify(option == 'abc')
has_arg, option = getopt.long_has_args('abc', ['abcd'])
! verify(not has_arg)
! verify(option == 'abcd')
expectException("has_arg, option = getopt.long_has_args('abc', ['def'])",
GetoptError)
***************
*** 45,62 ****
print 'Running tests on getopt.do_shorts'
opts, args = getopt.do_shorts([], 'a', 'a', [])
! assert opts == [('-a', '')]
! assert args == []
opts, args = getopt.do_shorts([], 'a1', 'a:', [])
! assert opts == [('-a', '1')]
! assert args == []
#opts, args = getopt.do_shorts([], 'a=1', 'a:', [])
! #assert opts == [('-a', '1')]
! #assert args == []
opts, args = getopt.do_shorts([], 'a', 'a:', ['1'])
! assert opts == [('-a', '1')]
! assert args == []
opts, args = getopt.do_shorts([], 'a', 'a:', ['1', '2'])
! assert opts == [('-a', '1')]
! assert args == ['2']
expectException("opts, args = getopt.do_shorts([], 'a1', 'a', [])",
GetoptError)
--- 45,62 ----
print 'Running tests on getopt.do_shorts'
opts, args = getopt.do_shorts([], 'a', 'a', [])
! verify(opts == [('-a', '')])
! verify(args == [])
opts, args = getopt.do_shorts([], 'a1', 'a:', [])
! verify(opts == [('-a', '1')])
! verify(args == [])
#opts, args = getopt.do_shorts([], 'a=1', 'a:', [])
! #verify(opts == [('-a', '1')])
! #verify(args == [])
opts, args = getopt.do_shorts([], 'a', 'a:', ['1'])
! verify(opts == [('-a', '1')])
! verify(args == [])
opts, args = getopt.do_shorts([], 'a', 'a:', ['1', '2'])
! verify(opts == [('-a', '1')])
! verify(args == ['2'])
expectException("opts, args = getopt.do_shorts([], 'a1', 'a', [])",
GetoptError)
***************
*** 67,87 ****
print 'Running tests on getopt.do_longs'
opts, args = getopt.do_longs([], 'abc', ['abc'], [])
! assert opts == [('--abc', '')]
! assert args == []
opts, args = getopt.do_longs([], 'abc=1', ['abc='], [])
! assert opts == [('--abc', '1')]
! assert args == []
opts, args = getopt.do_longs([], 'abc=1', ['abcd='], [])
! assert opts == [('--abcd', '1')]
! assert args == []
opts, args = getopt.do_longs([], 'abc', ['ab', 'abc', 'abcd'], [])
! assert opts == [('--abc', '')]
! assert args == []
# Much like the preceding, except with a non-alpha character ("-") in
# option name that precedes "="; failed in
# http://sourceforge.net/bugs/?func=detailbug&bug_id=126863&group_id=5470
opts, args = getopt.do_longs([], 'foo=42', ['foo-bar', 'foo=',], [])
! assert opts == [('--foo', '42')]
! assert args == []
expectException("opts, args = getopt.do_longs([], 'abc=1', ['abc'], [])",
GetoptError)
--- 67,87 ----
print 'Running tests on getopt.do_longs'
opts, args = getopt.do_longs([], 'abc', ['abc'], [])
! verify(opts == [('--abc', '')])
! verify(args == [])
opts, args = getopt.do_longs([], 'abc=1', ['abc='], [])
! verify(opts == [('--abc', '1')])
! verify(args == [])
opts, args = getopt.do_longs([], 'abc=1', ['abcd='], [])
! verify(opts == [('--abcd', '1')])
! verify(args == [])
opts, args = getopt.do_longs([], 'abc', ['ab', 'abc', 'abcd'], [])
! verify(opts == [('--abc', '')])
! verify(args == [])
# Much like the preceding, except with a non-alpha character ("-") in
# option name that precedes "="; failed in
# http://sourceforge.net/bugs/?func=detailbug&bug_id=126863&group_id=5470
opts, args = getopt.do_longs([], 'foo=42', ['foo-bar', 'foo=',], [])
! verify(opts == [('--foo', '42')])
! verify(args == [])
expectException("opts, args = getopt.do_longs([], 'abc=1', ['abc'], [])",
GetoptError)
***************
*** 97,105 ****
print 'Running tests on getopt.getopt'
opts, args = getopt.getopt(cmdline, 'a:b', ['alpha=', 'beta'])
! assert opts == [('-a', '1'), ('-b', ''), ('--alpha', '2'), ('--beta', ''),
! ('-a', '3'), ('-a', ''), ('--beta', '')]
# Note ambiguity of ('-b', '') and ('-a', '') above. This must be
# accounted for in the code that calls getopt().
! assert args == ['arg1', 'arg2']
expectException(
--- 97,105 ----
print 'Running tests on getopt.getopt'
opts, args = getopt.getopt(cmdline, 'a:b', ['alpha=', 'beta'])
! verify(opts == [('-a', '1'), ('-b', ''), ('--alpha', '2'), ('--beta', ''),
! ('-a', '3'), ('-a', ''), ('--beta', '')] )
# Note ambiguity of ('-b', '') and ('-a', '') above. This must be
# accounted for in the code that calls getopt().
! verify(args == ['arg1', 'arg2'])
expectException(
Index: test_gl.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gl.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** test_gl.py 2000/10/23 17:22:07 1.5
--- test_gl.py 2001/01/17 19:11:13 1.6
***************
*** 4,8 ****
Roger E. Masse
"""
! from test_support import verbose, TestSkipped
import gl, GL, time
--- 4,8 ----
Roger E. Masse
"""
! from test_support import verify, verbose, TestSkipped
import gl, GL, time
Index: test_grammar.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grammar.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** test_grammar.py 2000/12/12 23:11:42 1.21
--- test_grammar.py 2001/01/17 19:11:13 1.22
***************
*** 84,99 ****
print '1.1.3 String literals'
! ##def assert(s):
## if not s: raise TestFailed, 'see traceback'
! x = ''; y = ""; assert(len(x) == 0 and x == y)
! x = '\''; y = "'"; assert(len(x) == 1 and x == y and ord(x) == 39)
! x = '"'; y = "\""; assert(len(x) == 1 and x == y and ord(x) == 34)
x = "doesn't \"shrink\" does it"
y = 'doesn\'t "shrink" does it'
! assert(len(x) == 24 and x == y)
x = "does \"shrink\" doesn't it"
y = 'does "shrink" doesn\'t it'
! assert(len(x) == 24 and x == y)
x = """
The "quick"
--- 84,99 ----
print '1.1.3 String literals'
! ##def verify(s):
## if not s: raise TestFailed, 'see traceback'
! x = ''; y = ""; verify(len(x) == 0 and x == y)
! x = '\''; y = "'"; verify(len(x) == 1 and x == y and ord(x) == 39)
! x = '"'; y = "\""; verify(len(x) == 1 and x == y and ord(x) == 34)
x = "doesn't \"shrink\" does it"
y = 'doesn\'t "shrink" does it'
! verify(len(x) == 24 and x == y)
x = "does \"shrink\" doesn't it"
y = 'does "shrink" doesn\'t it'
! verify(len(x) == 24 and x == y)
x = """
The "quick"
***************
*** 103,107 ****
"""
y = '\nThe "quick"\nbrown fox\njumps over\nthe \'lazy\' dog.\n'
! assert(x == y)
y = '''
The "quick"
--- 103,107 ----
"""
y = '\nThe "quick"\nbrown fox\njumps over\nthe \'lazy\' dog.\n'
! verify(x == y)
y = '''
The "quick"
***************
*** 109,113 ****
jumps over
the 'lazy' dog.
! '''; assert(x == y)
y = "\n\
The \"quick\"\n\
--- 109,113 ----
jumps over
the 'lazy' dog.
! '''; verify(x == y)
y = "\n\
The \"quick\"\n\
***************
*** 115,119 ****
jumps over\n\
the 'lazy' dog.\n\
! "; assert(x == y)
y = '\n\
The \"quick\"\n\
--- 115,119 ----
jumps over\n\
the 'lazy' dog.\n\
! "; verify(x == y)
y = '\n\
The \"quick\"\n\
***************
*** 121,125 ****
jumps over\n\
the \'lazy\' dog.\n\
! '; assert(x == y)
--- 121,125 ----
jumps over\n\
the \'lazy\' dog.\n\
! '; verify(x == y)
Index: test_grp.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grp.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** test_grp.py 2000/10/23 17:22:07 1.5
--- test_grp.py 2001/01/17 19:11:13 1.6
***************
*** 5,9 ****
import grp
! from test_support import verbose
groups = grp.getgrall()
--- 5,9 ----
import grp
! from test_support import verify, verbose
groups = grp.getgrall()
Index: test_gzip.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gzip.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_gzip.py 2000/10/23 17:22:07 1.4
--- test_gzip.py 2001/01/17 19:11:13 1.5
***************
*** 19,23 ****
f = gzip.GzipFile(filename, 'rb') ; d = f.read() ; f.close()
! assert d == data1*50
# Append to the previous file
--- 19,23 ----
f = gzip.GzipFile(filename, 'rb') ; d = f.read() ; f.close()
! verify(d == data1*50)
# Append to the previous file
***************
*** 25,29 ****
f = gzip.GzipFile(filename, 'rb') ; d = f.read() ; f.close()
! assert d == (data1*50) + (data2*15)
# Try .readline() with varying line lengths
--- 25,29 ----
f = gzip.GzipFile(filename, 'rb') ; d = f.read() ; f.close()
! verify(d == (data1*50) + (data2*15))
# Try .readline() with varying line lengths
***************
*** 34,38 ****
L = f.readline( line_length )
if L == "" and line_length != 0: break
! assert len(L) <= line_length
line_length = (line_length + 1) % 50
f.close()
--- 34,38 ----
L = f.readline( line_length )
if L == "" and line_length != 0: break
! verify(len(L) <= line_length)
line_length = (line_length + 1) % 50
f.close()
Index: test_imageop.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_imageop.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** test_imageop.py 2000/10/23 17:22:07 1.9
--- test_imageop.py 2001/01/17 19:11:13 1.10
***************
*** 6,10 ****
"""
! from test_support import verbose, unlink
import imageop, uu
--- 6,10 ----
"""
! from test_support import verify, verbose, unlink
import imageop, uu
Index: test_imgfile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_imgfile.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** test_imgfile.py 2000/10/23 17:22:07 1.7
--- test_imgfile.py 2001/01/17 19:11:13 1.8
***************
*** 5,9 ****
"""
! from test_support import verbose, unlink, findfile
import imgfile, uu, os
--- 5,9 ----
"""
! from test_support import verify, verbose, unlink, findfile
import imgfile, uu, os
Index: test_long.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_long.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** test_long.py 2000/10/23 17:22:07 1.5
--- test_long.py 2001/01/17 19:11:13 1.6
***************
*** 1,3 ****
! from test_support import TestFailed, verbose
from string import join
from random import random, randint
--- 1,3 ----
! from test_support import verify, verbose, TestFailed
from string import join
from random import random, randint
***************
*** 42,46 ****
def getran(ndigits):
! assert ndigits > 0
nbits_hi = ndigits * SHIFT
nbits_lo = nbits_hi - SHIFT + 1
--- 42,46 ----
def getran(ndigits):
! verify(ndigits > 0)
nbits_hi = ndigits * SHIFT
nbits_lo = nbits_hi - SHIFT + 1
***************
*** 51,55 ****
bits = (r >> 1) + 1
bits = min(bits, nbits_hi - nbits)
! assert 1 <= bits <= SHIFT
nbits = nbits + bits
answer = answer << bits
--- 51,55 ----
bits = (r >> 1) + 1
bits = min(bits, nbits_hi - nbits)
! verify(1 <= bits <= SHIFT)
nbits = nbits + bits
answer = answer << bits
***************
*** 57,61 ****
answer = answer | ((1 << bits) - 1)
r = int(random() * (SHIFT * 2))
! assert nbits_lo <= nbits <= nbits_hi
if random() < 0.5:
answer = -answer
--- 57,61 ----
answer = answer | ((1 << bits) - 1)
r = int(random() * (SHIFT * 2))
! verify(nbits_lo <= nbits <= nbits_hi)
if random() < 0.5:
answer = -answer
Index: test_minidom.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_minidom.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** test_minidom.py 2001/01/02 20:56:42 1.19
--- test_minidom.py 2001/01/17 19:11:13 1.20
***************
*** 8,12 ****
import sys
import traceback
! from test_support import verbose
if __name__ == "__main__":
--- 8,12 ----
import sys
import traceback
! from test_support import verify, verbose
if __name__ == "__main__":
Index: test_mmap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** test_mmap.py 2001/01/14 05:05:51 1.13
--- test_mmap.py 2001/01/17 19:11:13 1.14
***************
*** 1,2 ****
--- 1,3 ----
+ from test_support import verify
import mmap
import string, os, re, sys
***************
*** 22,34 ****
print type(m) # SF bug 128713: segfaulted on Linux
print ' Position of foo:', string.find(m, 'foo') / float(PAGESIZE), 'pages'
! assert string.find(m, 'foo') == PAGESIZE
print ' Length of file:', len(m) / float(PAGESIZE), 'pages'
! assert len(m) == 2*PAGESIZE
print ' Contents of byte 0:', repr(m[0])
! assert m[0] == '\0'
print ' Contents of first 3 bytes:', repr(m[0:3])
! assert m[0:3] == '\0\0\0'
# Modify the file's content
--- 23,35 ----
print type(m) # SF bug 128713: segfaulted on Linux
print ' Position of foo:', string.find(m, 'foo') / float(PAGESIZE), 'pages'
! verify(string.find(m, 'foo') == PAGESIZE)
print ' Length of file:', len(m) / float(PAGESIZE), 'pages'
! verify(len(m) == 2*PAGESIZE)
print ' Contents of byte 0:', repr(m[0])
! verify(m[0] == '\0')
print ' Contents of first 3 bytes:', repr(m[0:3])
! verify(m[0:3] == '\0\0\0')
# Modify the file's content
***************
*** 39,47 ****
# Check that the modification worked
print ' Contents of byte 0:', repr(m[0])
! assert m[0] == '3'
print ' Contents of first 3 bytes:', repr(m[0:3])
! assert m[0:3] == '3\0\0'
print ' Contents of second page:', repr(m[PAGESIZE-1 : PAGESIZE + 7])
! assert m[PAGESIZE-1 : PAGESIZE + 7] == '\0foobar\0'
m.flush()
--- 40,48 ----
# Check that the modification worked
print ' Contents of byte 0:', repr(m[0])
! verify(m[0] == '3')
print ' Contents of first 3 bytes:', repr(m[0:3])
! verify(m[0:3] == '3\0\0')
print ' Contents of second page:', repr(m[PAGESIZE-1 : PAGESIZE + 7])
! verify(m[PAGESIZE-1 : PAGESIZE + 7] == '\0foobar\0')
m.flush()
***************
*** 58,74 ****
print start / float(PAGESIZE), length
! assert start == PAGESIZE
! assert end == PAGESIZE + 6
# test seeking around (try to overflow the seek implementation)
m.seek(0,0)
print ' Seek to zeroth byte'
! assert m.tell() == 0
m.seek(42,1)
print ' Seek to 42nd byte'
! assert m.tell() == 42
m.seek(0,2)
print ' Seek to last byte'
! assert m.tell() == len(m)
print ' Try to seek to negative position...'
--- 59,75 ----
print start / float(PAGESIZE), length
! verify(start == PAGESIZE)
! verify(end == PAGESIZE + 6)
# test seeking around (try to overflow the seek implementation)
m.seek(0,0)
print ' Seek to zeroth byte'
! verify(m.tell() == 0)
m.seek(42,1)
print ' Seek to 42nd byte'
! verify(m.tell() == 42)
m.seek(0,2)
print ' Seek to last byte'
! verify(m.tell() == len(m))
print ' Try to seek to negative position...'
***************
*** 78,82 ****
pass
else:
! assert 0, 'expected a ValueError but did not get it'
print ' Try to seek beyond end of mmap...'
--- 79,83 ----
pass
else:
! verify(0, 'expected a ValueError but did not get it')
print ' Try to seek beyond end of mmap...'
***************
*** 86,90 ****
pass
else:
! assert 0, 'expected a ValueError but did not get it'
print ' Try to seek to negative position...'
--- 87,91 ----
pass
else:
! verify(0, 'expected a ValueError but did not get it')
print ' Try to seek to negative position...'
***************
*** 94,98 ****
pass
else:
! assert 0, 'expected a ValueError but did not get it'
# Try resizing map
--- 95,99 ----
pass
else:
! verify(0, 'expected a ValueError but did not get it')
# Try resizing map
***************
*** 107,111 ****
else:
# resize() is supported
! assert len(m) == 512, "len(m) is %d, but expecting 512" % (len(m),)
# Check that we can no longer seek beyond the new size.
try:
--- 108,113 ----
else:
# resize() is supported
! verify(len(m) == 512,
! "len(m) is %d, but expecting 512" % (len(m),) )
# Check that we can no longer seek beyond the new size.
try:
***************
*** 114,118 ****
pass
else:
! assert 0, 'Could seek beyond the new size'
m.close()
--- 116,120 ----
pass
else:
! verify(0, 'Could seek beyond the new size')
m.close()
Index: test_new.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_new.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** test_new.py 2000/12/12 23:11:42 1.6
--- test_new.py 2001/01/17 19:11:13 1.7
***************
*** 1,3 ****
! from test_support import verbose
import sys
import new
--- 1,3 ----
! from test_support import verify, verbose
import sys
import new
Index: test_nis.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_nis.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** test_nis.py 2000/12/12 23:11:42 1.9
--- test_nis.py 2001/01/17 19:11:13 1.10
***************
*** 1,3 ****
! from test_support import verbose, TestFailed, TestSkipped
import nis
--- 1,3 ----
! from test_support import verify, verbose, TestFailed, TestSkipped
import nis
Index: test_openpty.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_openpty.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_openpty.py 2000/10/23 17:22:07 1.4
--- test_openpty.py 2001/01/17 19:11:13 1.5
***************
*** 2,6 ****
import os
! from test_support import verbose, TestFailed, TestSkipped
try:
--- 2,6 ----
import os
! from test_support import verify, verbose, TestFailed, TestSkipped
try:
Index: test_parser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_parser.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_parser.py 2001/01/07 06:02:19 1.4
--- test_parser.py 2001/01/17 19:11:13 1.5
***************
*** 4,8 ****
import sys
! from test_support import TestFailed
#
--- 4,8 ----
import sys
! from test_support import verify, TestFailed
#
Index: test_pkg.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pkg.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** test_pkg.py 2000/10/23 17:22:07 1.10
--- test_pkg.py 2001/01/17 19:11:13 1.11
***************
*** 4,8 ****
from os import mkdir, rmdir # Can't test if these fail
del mkdir, rmdir
! from test_support import verbose, TestFailed
# Helpers to create and destroy hierarchies.
--- 4,8 ----
from os import mkdir, rmdir # Can't test if these fail
del mkdir, rmdir
! from test_support import verify, verbose, TestFailed
# Helpers to create and destroy hierarchies.
***************
*** 189,202 ****
import t7 as tas
print dir(tas)
! assert not t7
from t7 import sub as subpar
print dir(subpar)
! assert not t7 and not sub
from t7.sub import subsub as subsubsub
print dir(subsubsub)
! assert not t7 and not sub and not subsub
from t7.sub.subsub import spam as ham
print "t7.sub.subsub.spam =", ham
! assert not t7 and not sub and not subsub
"""),
--- 189,202 ----
import t7 as tas
print dir(tas)
! verify(not t7)
from t7 import sub as subpar
print dir(subpar)
! verify(not t7 and not sub)
from t7.sub import subsub as subsubsub
print dir(subsubsub)
! verify(not t7 and not sub and not subsub)
from t7.sub.subsub import spam as ham
print "t7.sub.subsub.spam =", ham
! verify(not t7 and not sub and not subsub)
"""),
Index: test_poll.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_poll.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_poll.py 2000/10/23 17:22:07 1.4
--- test_poll.py 2001/01/17 19:11:13 1.5
***************
*** 2,6 ****
import sys, os, select, random
! from test_support import verbose, TestSkipped, TESTFN
try:
--- 2,6 ----
import sys, os, select, random
! from test_support import verify, verbose, TestSkipped, TESTFN
try:
***************
*** 56,60 ****
rd = random.choice(ready_readers)
buf = os.read(rd, MSG_LEN)
! assert len(buf) == MSG_LEN
print buf
os.close(r2w[rd]) ; os.close( rd )
--- 56,60 ----
rd = random.choice(ready_readers)
buf = os.read(rd, MSG_LEN)
! verify(len(buf) == MSG_LEN)
print buf
os.close(r2w[rd]) ; os.close( rd )
***************
*** 76,80 ****
p.register(FD)
r = p.poll()
! assert r[0] == (FD, select.POLLNVAL)
f = open(TESTFN, 'w')
--- 76,80 ----
p.register(FD)
r = p.poll()
! verify(r[0] == (FD, select.POLLNVAL))
f = open(TESTFN, 'w')
***************
*** 83,90 ****
p.register(f)
r = p.poll()
! assert r[0][0] == fd
f.close()
r = p.poll()
! assert r[0] == (fd, select.POLLNVAL)
os.unlink(TESTFN)
--- 83,90 ----
p.register(f)
r = p.poll()
! verify(r[0][0] == fd)
f.close()
r = p.poll()
! verify(r[0] == (fd, select.POLLNVAL))
os.unlink(TESTFN)
Index: test_pty.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pty.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** test_pty.py 2000/12/12 23:11:42 1.7
--- test_pty.py 2001/01/17 19:11:13 1.8
***************
*** 1,4 ****
import pty, os, sys, string
! from test_support import verbose, TestFailed, TestSkipped
TEST_STRING_1 = "I wish to buy a fish license."
--- 1,4 ----
import pty, os, sys, string
! from test_support import verify, verbose, TestFailed, TestSkipped
TEST_STRING_1 = "I wish to buy a fish license."
Index: test_pwd.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pwd.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** test_pwd.py 2000/12/12 23:11:42 1.8
--- test_pwd.py 2001/01/17 19:11:13 1.9
***************
*** 1,3 ****
! from test_support import verbose
import pwd
import string
--- 1,3 ----
! from test_support import verify, verbose
import pwd
import string
Index: test_re.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** test_re.py 2000/12/12 23:11:42 1.27
--- test_re.py 2001/01/17 19:11:13 1.28
***************
*** 2,6 ****
sys.path = ['.'] + sys.path
! from test_support import verbose, TestFailed
import re
import sys, os, string, traceback
--- 2,6 ----
sys.path = ['.'] + sys.path
! from test_support import verify, verbose, TestFailed
import re
import sys, os, string, traceback
***************
*** 12,29 ****
try:
! assert re.search('x*', 'axx').span(0) == (0, 0)
! assert re.search('x*', 'axx').span() == (0, 0)
! 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"
try:
! assert re.match('a*', 'xxx').span(0) == (0, 0)
! assert re.match('a*', 'xxx').span() == (0, 0)
! 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"
--- 12,29 ----
try:
! verify(re.search('x*', 'axx').span(0) == (0, 0))
! verify(re.search('x*', 'axx').span() == (0, 0))
! verify(re.search('x+', 'axx').span(0) == (1, 3))
! verify(re.search('x+', 'axx').span() == (1, 3))
! verify(re.search('x', 'aaa') is None)
except:
raise TestFailed, "re.search"
try:
! verify(re.match('a*', 'xxx').span(0) == (0, 0))
! verify(re.match('a*', 'xxx').span() == (0, 0))
! verify(re.match('x*', 'xxxa').span(0) == (0, 3))
! verify(re.match('x*', 'xxxa').span() == (0, 3))
! verify(re.match('a+', 'xxx') is None)
except:
raise TestFailed, "re.search"
***************
*** 33,37 ****
try:
! assert re.sub("(?i)b+", "x", "bbbb BBBB") == 'x x'
def bump_num(matchobj):
--- 33,37 ----
try:
! verify(re.sub("(?i)b+", "x", "bbbb BBBB") == 'x x')
def bump_num(matchobj):
***************
*** 39,63 ****
return str(int_value + 1)
! assert re.sub(r'\d+', bump_num, '08.2 -2 23x99y') == '9.3 -3 24x100y'
! assert re.sub(r'\d+', bump_num, '08.2 -2 23x99y', 3) == '9.3 -3 23x99y'
! assert re.sub('.', lambda m: r"\n", 'x') == '\\n'
! assert re.sub('.', r"\n", 'x') == '\n'
s = r"\1\1"
! assert re.sub('(.)', s, 'x') == 'xx'
! assert re.sub('(.)', re.escape(s), 'x') == s
! assert re.sub('(.)', lambda m: s, 'x') == s
!
! assert re.sub('(?P<a>x)', '\g<a>\g<a>', 'xx') == 'xxxx'
! assert re.sub('(?P<a>x)', '\g<a>\g<1>', 'xx') == 'xxxx'
! assert re.sub('(?P<unk>x)', '\g<unk>\g<unk>', 'xx') == 'xxxx'
! assert re.sub('(?P<unk>x)', '\g<1>\g<1>', 'xx') == 'xxxx'
!
! assert re.sub('a', r'\t\n\v\r\f\a\b\B\Z\a\A\w\W\s\S\d\D', 'a') == '\t\n\v\r\f\a\b\\B\\Z\a\\A\\w\\W\\s\\S\\d\\D'
! assert re.sub('a', '\t\n\v\r\f\a', 'a') == '\t\n\v\r\f\a'
! assert re.sub('a', '\t\n\v\r\f\a', 'a') == (chr(9)+chr(10)+chr(11)+chr(13)+chr(12)+chr(7))
! assert re.sub('^\s*', 'X', 'test') == 'Xtest'
except AssertionError:
raise TestFailed, "re.sub"
--- 39,63 ----
return str(int_value + 1)
! verify(re.sub(r'\d+', bump_num, '08.2 -2 23x99y') == '9.3 -3 24x100y')
! verify(re.sub(r'\d+', bump_num, '08.2 -2 23x99y', 3) == '9.3 -3 23x99y')
! verify(re.sub('.', lambda m: r"\n", 'x') == '\\n')
! verify(re.sub('.', r"\n", 'x') == '\n')
s = r"\1\1"
! verify(re.sub('(.)', s, 'x') == 'xx')
! verify(re.sub('(.)', re.escape(s), 'x') == s)
! verify(re.sub('(.)', lambda m: s, 'x') == s)
!
! verify(re.sub('(?P<a>x)', '\g<a>\g<a>', 'xx') == 'xxxx')
! verify(re.sub('(?P<a>x)', '\g<a>\g<1>', 'xx') == 'xxxx')
! verify(re.sub('(?P<unk>x)', '\g<unk>\g<unk>', 'xx') == 'xxxx')
! verify(re.sub('(?P<unk>x)', '\g<1>\g<1>', 'xx') == 'xxxx')
!
! verify(re.sub('a', r'\t\n\v\r\f\a\b\B\Z\a\A\w\W\s\S\d\D', 'a') == '\t\n\v\r\f\a\b\\B\\Z\a\\A\\w\\W\\s\\S\\d\\D')
! verify(re.sub('a', '\t\n\v\r\f\a', 'a') == '\t\n\v\r\f\a')
! verify(re.sub('a', '\t\n\v\r\f\a', 'a') == (chr(9)+chr(10)+chr(11)+chr(13)+chr(12)+chr(7)))
! verify(re.sub('^\s*', 'X', 'test') == 'Xtest')
except AssertionError:
raise TestFailed, "re.sub"
***************
*** 65,70 ****
try:
! assert re.sub('a', 'b', 'aaaaa') == 'bbbbb'
! assert re.sub('a', 'b', 'aaaaa', 1) == 'baaaa'
except AssertionError:
raise TestFailed, "qualified re.sub"
--- 65,70 ----
try:
! verify(re.sub('a', 'b', 'aaaaa') == 'bbbbb')
! verify(re.sub('a', 'b', 'aaaaa', 1) == 'baaaa')
except AssertionError:
raise TestFailed, "qualified re.sub"
***************
*** 133,141 ****
try:
! assert re.subn("(?i)b+", "x", "bbbb BBBB") == ('x x', 2)
! assert re.subn("b+", "x", "bbbb BBBB") == ('x BBBB', 1)
! assert re.subn("b+", "x", "xyz") == ('xyz', 0)
! assert re.subn("b*", "x", "xyz") == ('xxxyxzx', 4)
! assert re.subn("b*", "x", "xyz", 2) == ('xxxyz', 2)
except AssertionError:
raise TestFailed, "re.subn"
--- 133,141 ----
try:
! verify(re.subn("(?i)b+", "x", "bbbb BBBB") == ('x x', 2))
! verify(re.subn("b+", "x", "bbbb BBBB") == ('x BBBB', 1))
! verify(re.subn("b+", "x", "xyz") == ('xyz', 0))
! verify(re.subn("b*", "x", "xyz") == ('xxxyxzx', 4))
! verify(re.subn("b*", "x", "xyz", 2) == ('xxxyz', 2))
except AssertionError:
raise TestFailed, "re.subn"
***************
*** 145,166 ****
try:
! assert re.split(":", ":a:b::c") == ['', 'a', 'b', '', 'c']
! assert re.split(":*", ":a:b::c") == ['', 'a', 'b', 'c']
! assert re.split("(:*)", ":a:b::c") == ['', ':', 'a', ':', 'b', '::', 'c']
! assert re.split("(?::*)", ":a:b::c") == ['', 'a', 'b', 'c']
! assert re.split("(:)*", ":a:b::c") == ['', ':', 'a', ':', 'b', ':', 'c']
! assert re.split("([b:]+)", ":a:b::c") == ['', ':', 'a', ':b::', 'c']
! assert re.split("(b)|(:+)", ":a:b::c") == \
! ['', None, ':', 'a', None, ':', '', 'b', None, '', None, '::', 'c']
! assert re.split("(?:b)|(?::+)", ":a:b::c") == ['', 'a', '', '', 'c']
except AssertionError:
raise TestFailed, "re.split"
try:
! assert re.split(":", ":a:b::c", 2) == ['', 'a', 'b::c']
! assert re.split(':', 'a:b:c:d', 2) == ['a', 'b', 'c:d']
! assert re.split("(:)", ":a:b::c", 2) == ['', ':', 'a', ':', 'b::c']
! assert re.split("(:*)", ":a:b::c", 2) == ['', ':', 'a', ':', 'b::c']
except AssertionError:
raise TestFailed, "qualified re.split"
--- 145,166 ----
try:
! verify(re.split(":", ":a:b::c") == ['', 'a', 'b', '', 'c'])
! verify(re.split(":*", ":a:b::c") == ['', 'a', 'b', 'c'])
! verify(re.split("(:*)", ":a:b::c") == ['', ':', 'a', ':', 'b', '::', 'c'])
! verify(re.split("(?::*)", ":a:b::c") == ['', 'a', 'b', 'c'])
! verify(re.split("(:)*", ":a:b::c") == ['', ':', 'a', ':', 'b', ':', 'c'])
! verify(re.split("([b:]+)", ":a:b::c") == ['', ':', 'a', ':b::', 'c'])
! verify(re.split("(b)|(:+)", ":a:b::c") == \
! ['', None, ':', 'a', None, ':', '', 'b', None, '', None, '::', 'c'] )
! verify(re.split("(?:b)|(?::+)", ":a:b::c") == ['', 'a', '', '', 'c'])
except AssertionError:
raise TestFailed, "re.split"
try:
! verify(re.split(":", ":a:b::c", 2) == ['', 'a', 'b::c'])
! verify(re.split(':', 'a:b:c:d', 2) == ['a', 'b', 'c:d'])
! verify(re.split("(:)", ":a:b::c", 2) == ['', ':', 'a', ':', 'b::c'])
! verify(re.split("(:*)", ":a:b::c", 2) == ['', ':', 'a', ':', 'b::c'])
except AssertionError:
raise TestFailed, "qualified re.split"
***************
*** 170,179 ****
try:
! assert re.findall(":+", "abc") == []
! assert re.findall(":+", "a:b::c:::d") == [":", "::", ":::"]
! assert re.findall("(:+)", "a:b::c:::d") == [":", "::", ":::"]
! assert re.findall("(:)(:*)", "a:b::c:::d") == [(":", ""),
(":", ":"),
! (":", "::")]
except AssertionError:
raise TestFailed, "re.findall"
--- 170,179 ----
try:
! verify(re.findall(":+", "abc") == [])
! verify(re.findall(":+", "a:b::c:::d") == [":", "::", ":::"])
! verify(re.findall("(:+)", "a:b::c:::d") == [":", "::", ":::"])
! verify(re.findall("(:)(:*)", "a:b::c:::d") == [(":", ""),
(":", ":"),
! (":", "::")] )
except AssertionError:
raise TestFailed, "re.findall"
***************
*** 184,197 ****
try:
# No groups at all
! m = re.match('a', 'a') ; assert m.groups() == ()
# A single group
! m = re.match('(a)', 'a') ; assert m.groups() == ('a',)
pat = re.compile('((a)|(b))(c)?')
! assert pat.match('a').groups() == ('a', 'a', None, None)
! assert pat.match('b').groups() == ('b', None, 'b', None)
! assert pat.match('ac').groups() == ('a', 'a', None, 'c')
! assert pat.match('bc').groups() == ('b', None, 'b', 'c')
! assert pat.match('bc').groups("") == ('b', "", 'b', 'c')
except AssertionError:
raise TestFailed, "match .groups() method"
--- 184,197 ----
try:
# No groups at all
! m = re.match('a', 'a') ; verify(m.groups() == ())
# A single group
! m = re.match('(a)', 'a') ; verify(m.groups() == ('a',))
pat = re.compile('((a)|(b))(c)?')
! verify(pat.match('a').groups() == ('a', 'a', None, None))
! verify(pat.match('b').groups() == ('b', None, 'b', None))
! verify(pat.match('ac').groups() == ('a', 'a', None, 'c'))
! verify(pat.match('bc').groups() == ('b', None, 'b', 'c'))
! verify(pat.match('bc').groups("") == ('b', "", 'b', 'c'))
except AssertionError:
raise TestFailed, "match .groups() method"
***************
*** 200,210 ****
# A single group
m = re.match('(a)', 'a')
! assert m.group(0) == 'a' ; assert m.group(0) == 'a'
! assert m.group(1) == 'a' ; assert m.group(1, 1) == ('a', 'a')
pat = re.compile('(?:(?P<a1>a)|(?P<b2>b))(?P<c3>c)?')
! assert pat.match('a').group(1, 2, 3) == ('a', None, None)
! assert pat.match('b').group('a1', 'b2', 'c3') == (None, 'b', None)
! assert pat.match('ac').group(1, 'b2', 3) == ('a', None, 'c')
except AssertionError:
raise TestFailed, "match .group() method"
--- 200,212 ----
# A single group
m = re.match('(a)', 'a')
! verify(m.group(0) == 'a')
! verify(m.group(0) == 'a')
! verify(m.group(1) == 'a')
! verify(m.group(1, 1) == ('a', 'a'))
pat = re.compile('(?:(?P<a1>a)|(?P<b2>b))(?P<c3>c)?')
! verify(pat.match('a').group(1, 2, 3) == ('a', None, None))
! verify(pat.match('b').group('a1', 'b2', 'c3') == (None, 'b', None))
! verify(pat.match('ac').group(1, 'b2', 3) == ('a', None, 'c'))
except AssertionError:
raise TestFailed, "match .group() method"
***************
*** 217,226 ****
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:
raise TestFailed, "re.escape"
--- 219,228 ----
for i in range(0, 256):
p = p + chr(i)
! verify(re.match(re.escape(chr(i)), chr(i)) is not None)
! verify(re.match(re.escape(chr(i)), chr(i)).span() == (0,1))
pat=re.compile( re.escape(p) )
! verify(pat.match(p) is not None)
! verify(pat.match(p).span() == (0,256))
except AssertionError:
raise TestFailed, "re.escape"
***************
*** 236,244 ****
try:
! assert re.I == re.IGNORECASE
! assert re.L == re.LOCALE
! assert re.M == re.MULTILINE
! assert re.S == re.DOTALL
! assert re.X == re.VERBOSE
except AssertionError:
raise TestFailed, 're module constants'
--- 238,246 ----
try:
! verify(re.I == re.IGNORECASE)
! verify(re.L == re.LOCALE)
! verify(re.M == re.MULTILINE)
! verify(re.S == re.DOTALL)
! verify(re.X == re.VERBOSE)
except AssertionError:
raise TestFailed, 're module constants'
***************
*** 256,260 ****
# implementation of repeated groups.
try:
! assert re.match('(x)*', 50000*'x').span() == (0, 50000)
except RuntimeError, v:
print v
--- 258,262 ----
# implementation of repeated groups.
try:
! verify(re.match('(x)*', 50000*'x').span() == (0, 50000))
except RuntimeError, v:
print v
Index: test_regex.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_regex.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** test_regex.py 2001/01/17 03:12:01 1.7
--- test_regex.py 2001/01/17 19:11:13 1.8
***************
*** 1,3 ****
! from test_support import verbose
import warnings
warnings.filterwarnings("ignore", "the regex module is deprecated",
--- 1,3 ----
! from test_support import verify, verbose
import warnings
warnings.filterwarnings("ignore", "the regex module is deprecated",
Index: test_rfc822.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_rfc822.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** test_rfc822.py 2000/10/23 17:30:23 1.7
--- test_rfc822.py 2001/01/17 19:11:13 1.8
***************
*** 1,3 ****
! from test_support import verbose
import rfc822, sys
try:
--- 1,3 ----
! from test_support import verify, verbose
import rfc822, sys
try:
Index: test_rgbimg.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_rgbimg.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** test_rgbimg.py 2000/10/23 17:22:08 1.10
--- test_rgbimg.py 2001/01/17 19:11:13 1.11
***************
*** 3,7 ****
import rgbimg, os, uu
! from test_support import verbose, unlink, findfile
class error(Exception):
--- 3,7 ----
import rgbimg, os, uu
! from test_support import verify, verbose, unlink, findfile
class error(Exception):
Index: test_sax.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sax.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** test_sax.py 2000/12/12 23:11:42 1.14
--- test_sax.py 2001/01/17 19:11:13 1.15
***************
*** 13,17 ****
from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl
from cStringIO import StringIO
! from test_support import verbose, TestFailed, findfile
# ===== Utilities
--- 13,17 ----
from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl
from cStringIO import StringIO
! from test_support import verify, verbose, TestFailed, findfile
# ===== Utilities
Index: test_select.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_select.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** test_select.py 2000/10/23 17:22:08 1.11
--- test_select.py 2001/01/17 19:11:13 1.12
***************
*** 1,4 ****
# Testing select module
! from test_support import verbose
import select
import os
--- 1,4 ----
# Testing select module
! from test_support import verify, verbose
import select
import os
Index: test_signal.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_signal.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** test_signal.py 2000/10/23 17:22:08 1.6
--- test_signal.py 2001/01/17 19:11:13 1.7
***************
*** 1,4 ****
# Test the signal module
! from test_support import verbose, TestSkipped
import signal
import os
--- 1,4 ----
# Test the signal module
! from test_support import verify, verbose, TestSkipped
import signal
import os
Index: test_socket.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** test_socket.py 2000/12/12 23:11:42 1.15
--- test_socket.py 2001/01/17 19:11:13 1.16
***************
*** 9,13 ****
! from test_support import verbose, TestFailed
import socket
import os
--- 9,13 ----
! from test_support import verify, verbose, TestFailed
import socket
import os
Index: test_sre.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sre.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** test_sre.py 2001/01/16 07:37:30 1.18
--- test_sre.py 2001/01/17 19:11:13 1.19
***************
*** 7,11 ****
sys.path=['.']+sys.path
! from test_support import verbose, TestFailed
import sre
import sys, os, string, traceback
--- 7,11 ----
sys.path=['.']+sys.path
! from test_support import verify, verbose, TestFailed
import sre
import sys, os, string, traceback
Index: test_strftime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strftime.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** test_strftime.py 2000/09/15 12:57:35 1.21
--- test_strftime.py 2001/01/17 19:11:13 1.22
***************
*** 4,8 ****
import time, calendar, sys, string, os, re
! from test_support import verbose
def main():
--- 4,8 ----
import time, calendar, sys, string, os, re
! from test_support import verify, verbose
def main():
Index: test_string.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_string.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** test_string.py 2000/10/23 17:22:08 1.12
--- test_string.py 2001/01/17 19:11:13 1.13
***************
*** 1,3 ****
! from test_support import verbose, TestSkipped
import string_tests
import string, sys
--- 1,3 ----
! from test_support import verify, verbose, TestSkipped
import string_tests
import string, sys
Index: test_strop.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strop.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** test_strop.py 2000/10/23 17:22:08 1.8
--- test_strop.py 2001/01/17 19:11:13 1.9
***************
*** 1,3 ****
! from test_support import verbose
import strop, sys
--- 1,3 ----
! from test_support import verify, verbose
import strop, sys
Index: test_sunaudiodev.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sunaudiodev.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** test_sunaudiodev.py 1998/04/23 20:13:25 1.7
--- test_sunaudiodev.py 2001/01/17 19:11:13 1.8
***************
*** 1,3 ****
! from test_support import verbose, findfile, TestFailed
import sunaudiodev
import os
--- 1,3 ----
! from test_support import verify, verbose, findfile, TestFailed
import sunaudiodev
import os
Index: test_support.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** test_support.py 2000/12/12 23:11:42 1.9
--- test_support.py 2001/01/17 19:11:13 1.10
***************
*** 72,73 ****
--- 72,85 ----
if os.path.exists(fn): return fn
return file
+
+ def verify(condition, reason='test failed'):
+
+ """ Verify that condition is true. If not, raise an
+ AssertionError.
+
+ The optinal argument reason can be given to provide
+ a better error text.
+
+ """
+ if not condition:
+ raise AssertionError,reason
Index: test_thread.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_thread.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** test_thread.py 2000/10/23 17:22:08 1.7
--- test_thread.py 2001/01/17 19:11:13 1.8
***************
*** 3,7 ****
# Create a bunch of threads, let each do some work, wait until all are done
! from test_support import verbose
import random
import thread
--- 3,7 ----
# Create a bunch of threads, let each do some work, wait until all are done
! from test_support import verify, verbose
import random
import thread
Index: test_timing.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_timing.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** test_timing.py 1997/01/13 23:03:07 1.1
--- test_timing.py 2001/01/17 19:11:13 1.2
***************
*** 1,3 ****
! from test_support import verbose
import timing
--- 1,3 ----
! from test_support import verify, verbose
import timing
Index: test_tokenize.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tokenize.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** test_tokenize.py 2000/10/23 17:22:08 1.3
--- test_tokenize.py 2001/01/17 19:11:13 1.4
***************
*** 1,3 ****
! from test_support import verbose, findfile
import tokenize, os, sys
--- 1,3 ----
! from test_support import verify, verbose, findfile
import tokenize, os, sys
Index: test_ucn.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ucn.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** test_ucn.py 2000/10/23 17:22:08 1.2
--- test_ucn.py 2001/01/17 19:11:13 1.3
***************
*** 6,9 ****
--- 6,11 ----
"""#"
+ from test_support import verify, verbose
+
print 'Testing General Unicode Character Name, and case insensitivity...',
***************
*** 35,47 ****
u"\N{LATIN SMALL LETTER P}" \
u"\N{FULL STOP}"
! assert s == u"The rEd fOx ate the sheep.", s
print "done."
# misc. symbol testing
print "Testing misc. symbols for unicode character name expansion....",
! assert u"\N{PILCROW SIGN}" == u"\u00b6"
! assert u"\N{REPLACEMENT CHARACTER}" == u"\uFFFD"
! assert u"\N{HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK}" == u"\uFF9F"
! assert u"\N{FULLWIDTH LATIN SMALL LETTER A}" == u"\uFF41"
print "done."
--- 37,49 ----
u"\N{LATIN SMALL LETTER P}" \
u"\N{FULL STOP}"
! verify(s == u"The rEd fOx ate the sheep.", s)
print "done."
# misc. symbol testing
print "Testing misc. symbols for unicode character name expansion....",
! verify(u"\N{PILCROW SIGN}" == u"\u00b6")
! verify(u"\N{REPLACEMENT CHARACTER}" == u"\uFFFD")
! verify(u"\N{HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK}" == u"\uFF9F")
! verify(u"\N{FULLWIDTH LATIN SMALL LETTER A}" == u"\uFF41")
print "done."
Index: test_unicode.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** test_unicode.py 2001/01/16 11:54:11 1.26
--- test_unicode.py 2001/01/17 19:11:13 1.27
***************
*** 5,10 ****
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
! """
! from test_support import verbose
import sys
--- 5,10 ----
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
! """#"
! from test_support import verify, verbose
import sys
***************
*** 174,186 ****
# Comparisons:
print 'Testing Unicode comparisons...',
! assert u'abc' == 'abc'
! assert 'abc' == u'abc'
! assert u'abc' == u'abc'
! assert u'abcd' > 'abc'
! assert 'abcd' > u'abc'
! assert u'abcd' > u'abc'
! assert u'abc' < 'abcd'
! assert 'abc' < u'abcd'
! assert u'abc' < u'abcd'
print 'done.'
--- 174,186 ----
# Comparisons:
print 'Testing Unicode comparisons...',
! verify(u'abc' == 'abc')
! verify('abc' == u'abc')
! verify(u'abc' == u'abc')
! verify(u'abcd' > 'abc')
! verify('abcd' > u'abc')
! verify(u'abcd' > u'abc')
! verify(u'abc' < 'abcd')
! verify('abc' < u'abcd')
! verify(u'abc' < u'abcd')
print 'done.'
***************
*** 190,200 ****
print 'Testing UTF-16 code point order comparisons...',
#No surrogates, no fixup required.
! assert u'\u0061' < u'\u20ac'
# Non surrogate below surrogate value, no fixup required
! assert u'\u0061' < u'\ud800\udc02'
# Non surrogate above surrogate value, fixup required
def test_lecmp(s, s2):
! assert s < s2 , "comparison failed on %s < %s" % (s, s2)
def test_fixup(s):
--- 190,200 ----
print 'Testing UTF-16 code point order comparisons...',
#No surrogates, no fixup required.
! verify(u'\u0061' < u'\u20ac')
# Non surrogate below surrogate value, no fixup required
! verify(u'\u0061' < u'\ud800\udc02')
# Non surrogate above surrogate value, fixup required
def test_lecmp(s, s2):
! verify(s < s2 , "comparison failed on %s < %s" % (s, s2))
def test_fixup(s):
***************
*** 236,240 ****
# Surrogates on both sides, no fixup required
! assert u'\ud800\udc02' < u'\ud84d\udc56'
print 'done.'
--- 236,240 ----
# Surrogates on both sides, no fixup required
! verify(u'\ud800\udc02' < u'\ud84d\udc56')
print 'done.'
***************
*** 307,346 ****
# Contains:
print 'Testing Unicode contains method...',
! assert ('a' in u'abdb') == 1
! assert ('a' in u'bdab') == 1
! assert ('a' in u'bdaba') == 1
! assert ('a' in u'bdba') == 1
! assert ('a' in u'bdba') == 1
! assert (u'a' in u'bdba') == 1
! assert (u'a' in u'bdb') == 0
! assert (u'a' in 'bdb') == 0
! assert (u'a' in 'bdba') == 1
! assert (u'a' in ('a',1,None)) == 1
! assert (u'a' in (1,None,'a')) == 1
! assert (u'a' in (1,None,u'a')) == 1
! assert ('a' in ('a',1,None)) == 1
! assert ('a' in (1,None,'a')) == 1
! assert ('a' in (1,None,u'a')) == 1
! assert ('a' in ('x',1,u'y')) == 0
! assert ('a' in ('x',1,None)) == 0
print 'done.'
# Formatting:
print 'Testing Unicode formatting strings...',
! assert u"%s, %s" % (u"abc", "abc") == u'abc, abc'
! assert u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", 1, 2, 3) == u'abc, abc, 1, 2.000000, 3.00'
! assert u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", 1, -2, 3) == u'abc, abc, 1, -2.000000, 3.00'
! assert u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 3.5) == u'abc, abc, -1, -2.000000, 3.50'
! assert u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 3.57) == u'abc, abc, -1, -2.000000, 3.57'
! assert u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 1003.57) == u'abc, abc, -1, -2.000000, 1003.57'
! assert u"%c" % (u"a",) == u'a'
! assert u"%c" % ("a",) == u'a'
! assert u"%c" % (34,) == u'"'
! assert u"%c" % (36,) == u'$'
value = u"%r, %r" % (u"abc", "abc")
if value != u"u'abc', 'abc'":
print '*** formatting failed for "%s"' % 'u"%r, %r" % (u"abc", "abc")'
! assert u"%(x)s, %(y)s" % {'x':u"abc", 'y':"def"} == u'abc, def'
try:
value = u"%(x)s, %(ä)s" % {'x':u"abc", u'ä'.encode('utf-8'):"def"}
--- 307,346 ----
# Contains:
print 'Testing Unicode contains method...',
! verify(('a' in u'abdb') == 1)
! verify(('a' in u'bdab') == 1)
! verify(('a' in u'bdaba') == 1)
! verify(('a' in u'bdba') == 1)
! verify(('a' in u'bdba') == 1)
! verify((u'a' in u'bdba') == 1)
! verify((u'a' in u'bdb') == 0)
! verify((u'a' in 'bdb') == 0)
! verify((u'a' in 'bdba') == 1)
! verify((u'a' in ('a',1,None)) == 1)
! verify((u'a' in (1,None,'a')) == 1)
! verify((u'a' in (1,None,u'a')) == 1)
! verify(('a' in ('a',1,None)) == 1)
! verify(('a' in (1,None,'a')) == 1)
! verify(('a' in (1,None,u'a')) == 1)
! verify(('a' in ('x',1,u'y')) == 0)
! verify(('a' in ('x',1,None)) == 0)
print 'done.'
# Formatting:
print 'Testing Unicode formatting strings...',
! verify(u"%s, %s" % (u"abc", "abc") == u'abc, abc')
! verify(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", 1, 2, 3) == u'abc, abc, 1, 2.000000, 3.00')
! verify(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", 1, -2, 3) == u'abc, abc, 1, -2.000000, 3.00')
! verify(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 3.5) == u'abc, abc, -1, -2.000000, 3.50')
! verify(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 3.57) == u'abc, abc, -1, -2.000000, 3.57')
! verify(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 1003.57) == u'abc, abc, -1, -2.000000, 1003.57')
! verify(u"%c" % (u"a",) == u'a')
! verify(u"%c" % ("a",) == u'a')
! verify(u"%c" % (34,) == u'"')
! verify(u"%c" % (36,) == u'$')
value = u"%r, %r" % (u"abc", "abc")
if value != u"u'abc', 'abc'":
print '*** formatting failed for "%s"' % 'u"%r, %r" % (u"abc", "abc")'
! verify(u"%(x)s, %(y)s" % {'x':u"abc", 'y':"def"} == u'abc, def')
try:
value = u"%(x)s, %(ä)s" % {'x':u"abc", u'ä'.encode('utf-8'):"def"}
***************
*** 348,363 ****
print '*** formatting failed for "%s"' % "u'abc, def'"
else:
! assert value == u'abc, def'
# formatting jobs delegated from the string implementation:
! assert '...%(foo)s...' % {'foo':u"abc"} == u'...abc...'
! assert '...%(foo)s...' % {'foo':"abc"} == '...abc...'
! assert '...%(foo)s...' % {u'foo':"abc"} == '...abc...'
! assert '...%(foo)s...' % {u'foo':u"abc"} == u'...abc...'
! assert '...%(foo)s...' % {u'foo':u"abc",'def':123} == u'...abc...'
! assert '...%(foo)s...' % {u'foo':u"abc",u'def':123} == u'...abc...'
! assert '...%s...%s...%s...%s...' % (1,2,3,u"abc") == u'...1...2...3...abc...'
! assert '...%%...%%s...%s...%s...%s...%s...' % (1,2,3,u"abc") == u'...%...%s...1...2...3...abc...'
! assert '...%s...' % u"abc" == u'...abc...'
print 'done.'
--- 348,363 ----
print '*** formatting failed for "%s"' % "u'abc, def'"
else:
! verify(value == u'abc, def')
# formatting jobs delegated from the string implementation:
! verify('...%(foo)s...' % {'foo':u"abc"} == u'...abc...')
! verify('...%(foo)s...' % {'foo':"abc"} == '...abc...')
! verify('...%(foo)s...' % {u'foo':"abc"} == '...abc...')
! verify('...%(foo)s...' % {u'foo':u"abc"} == u'...abc...')
! verify('...%(foo)s...' % {u'foo':u"abc",'def':123} == u'...abc...')
! verify('...%(foo)s...' % {u'foo':u"abc",u'def':123} == u'...abc...')
! verify('...%s...%s...%s...%s...' % (1,2,3,u"abc") == u'...1...2...3...abc...')
! verify('...%%...%%s...%s...%s...%s...%s...' % (1,2,3,u"abc") == u'...%...%s...1...2...3...abc...')
! verify('...%s...' % u"abc" == u'...abc...')
print 'done.'
***************
*** 366,382 ****
# UTF-8 specific encoding tests:
! assert u'\u20ac'.encode('utf-8') == \
! ''.join((chr(0xe2), chr(0x82), chr(0xac)))
! assert u'\ud800\udc02'.encode('utf-8') == \
! ''.join((chr(0xf0), chr(0x90), chr(0x80), chr(0x82)))
! assert u'\ud84d\udc56'.encode('utf-8') == \
! ''.join((chr(0xf0), chr(0xa3), chr(0x91), chr(0x96)))
# UTF-8 specific decoding tests
! assert unicode(''.join((chr(0xf0), chr(0xa3), chr(0x91), chr(0x96))),
! 'utf-8') == u'\ud84d\udc56'
! assert unicode(''.join((chr(0xf0), chr(0x90), chr(0x80), chr(0x82))),
! 'utf-8') == u'\ud800\udc02'
! assert unicode(''.join((chr(0xe2), chr(0x82), chr(0xac))),
! 'utf-8') == u'\u20ac'
# Other possible utf-8 test cases:
--- 366,382 ----
# UTF-8 specific encoding tests:
! verify(u'\u20ac'.encode('utf-8') == \
! ''.join((chr(0xe2), chr(0x82), chr(0xac))) )
! verify(u'\ud800\udc02'.encode('utf-8') == \
! ''.join((chr(0xf0), chr(0x90), chr(0x80), chr(0x82))) )
! verify(u'\ud84d\udc56'.encode('utf-8') == \
! ''.join((chr(0xf0), chr(0xa3), chr(0x91), chr(0x96))) )
# UTF-8 specific decoding tests
! verify(unicode(''.join((chr(0xf0), chr(0xa3), chr(0x91), chr(0x96))),
! 'utf-8') == u'\ud84d\udc56' )
! verify(unicode(''.join((chr(0xf0), chr(0x90), chr(0x80), chr(0x82))),
! 'utf-8') == u'\ud800\udc02' )
! verify(unicode(''.join((chr(0xe2), chr(0x82), chr(0xac))),
! 'utf-8') == u'\u20ac' )
# Other possible utf-8 test cases:
***************
*** 386,393 ****
! assert unicode('hello','ascii') == u'hello'
! assert unicode('hello','utf-8') == u'hello'
! assert unicode('hello','utf8') == u'hello'
! assert unicode('hello','latin-1') == u'hello'
class String:
--- 386,393 ----
! verify(unicode('hello','ascii') == u'hello')
! verify(unicode('hello','utf-8') == u'hello')
! verify(unicode('hello','utf8') == u'hello')
! verify(unicode('hello','latin-1') == u'hello')
class String:
***************
*** 399,408 ****
o.x = 'abc'
! assert unicode(o) == u'abc'
! assert str(o) == 'abc'
o.x = u'abc'
! assert unicode(o) == u'abc'
! assert str(o) == 'abc'
try:
--- 399,408 ----
o.x = 'abc'
! verify(unicode(o) == u'abc')
! verify(str(o) == 'abc')
o.x = u'abc'
! verify(unicode(o) == u'abc')
! verify(str(o) == 'abc')
try:
***************
*** 413,418 ****
else:
raise AssertionError, "u'Andr\202'.encode('ascii') failed to raise an exception"
! assert u'Andr\202 x'.encode('ascii','ignore') == "Andr x"
! assert u'Andr\202 x'.encode('ascii','replace') == "Andr? x"
try:
--- 413,418 ----
else:
raise AssertionError, "u'Andr\202'.encode('ascii') failed to raise an exception"
! verify(u'Andr\202 x'.encode('ascii','ignore') == "Andr x")
! verify(u'Andr\202 x'.encode('ascii','replace') == "Andr? x")
try:
***************
*** 423,440 ****
else:
raise AssertionError, "unicode('Andr\202') failed to raise an exception"
! assert unicode('Andr\202 x','ascii','ignore') == u"Andr x"
! assert unicode('Andr\202 x','ascii','replace') == u'Andr\uFFFD x'
! assert u'hello'.encode('ascii') == 'hello'
! assert u'hello'.encode('utf-8') == 'hello'
! assert u'hello'.encode('utf8') == 'hello'
! assert u'hello'.encode('utf-16-le') == 'h\000e\000l\000l\000o\000'
! assert u'hello'.encode('utf-16-be') == '\000h\000e\000l\000l\000o'
! assert u'hello'.encode('latin-1') == 'hello'
u = u''.join(map(unichr, range(1024)))
for encoding in ('utf-8', 'utf-16', 'utf-16-le', 'utf-16-be',
'raw_unicode_escape', 'unicode_escape', 'unicode_internal'):
! assert unicode(u.encode(encoding),encoding) == u
u = u''.join(map(unichr, range(256)))
--- 423,440 ----
else:
raise AssertionError, "unicode('Andr\202') failed to raise an exception"
! verify(unicode('Andr\202 x','ascii','ignore') == u"Andr x")
! verify(unicode('Andr\202 x','ascii','replace') == u'Andr\uFFFD x')
! verify(u'hello'.encode('ascii') == 'hello')
! verify(u'hello'.encode('utf-8') == 'hello')
! verify(u'hello'.encode('utf8') == 'hello')
! verify(u'hello'.encode('utf-16-le') == 'h\000e\000l\000l\000o\000')
! verify(u'hello'.encode('utf-16-be') == '\000h\000e\000l\000l\000o')
! verify(u'hello'.encode('latin-1') == 'hello')
u = u''.join(map(unichr, range(1024)))
for encoding in ('utf-8', 'utf-16', 'utf-16-le', 'utf-16-be',
'raw_unicode_escape', 'unicode_escape', 'unicode_internal'):
! verify(unicode(u.encode(encoding),encoding) == u)
u = u''.join(map(unichr, range(256)))
***************
*** 443,447 ****
):
try:
! assert unicode(u.encode(encoding),encoding) == u
except AssertionError:
print '*** codec "%s" failed round-trip' % encoding
--- 443,447 ----
):
try:
! verify(unicode(u.encode(encoding),encoding) == u)
except AssertionError:
print '*** codec "%s" failed round-trip' % encoding
***************
*** 454,458 ****
):
try:
! assert unicode(u.encode(encoding),encoding) == u
except AssertionError:
print '*** codec "%s" failed round-trip' % encoding
--- 454,458 ----
):
try:
! verify(unicode(u.encode(encoding),encoding) == u)
except AssertionError:
print '*** codec "%s" failed round-trip' % encoding
***************
*** 488,492 ****
):
try:
! assert unicode(s,encoding).encode(encoding) == s
except AssertionError:
print '*** codec "%s" failed round-trip' % encoding
--- 488,492 ----
):
try:
! verify(unicode(s,encoding).encode(encoding) == s)
except AssertionError:
print '*** codec "%s" failed round-trip' % encoding
***************
*** 518,522 ****
):
try:
! assert unicode(s,encoding).encode(encoding) == s
except AssertionError:
print '*** codec "%s" failed round-trip' % encoding
--- 518,522 ----
):
try:
! verify(unicode(s,encoding).encode(encoding) == s)
except AssertionError:
print '*** codec "%s" failed round-trip' % encoding
***************
*** 527,534 ****
print 'Testing Unicode string concatenation...',
! assert (u"abc" u"def") == u"abcdef"
! assert ("abc" u"def") == u"abcdef"
! assert (u"abc" "def") == u"abcdef"
! assert (u"abc" u"def" "ghi") == u"abcdefghi"
! assert ("abc" "def" u"ghi") == u"abcdefghi"
print 'done.'
--- 527,534 ----
print 'Testing Unicode string concatenation...',
! verify((u"abc" u"def") == u"abcdef")
! verify(("abc" u"def") == u"abcdef")
! verify((u"abc" "def") == u"abcdef")
! verify((u"abc" u"def" "ghi") == u"abcdefghi")
! verify(("abc" "def" u"ghi") == u"abcdefghi")
print 'done.'
Index: test_unicodedata.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicodedata.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_unicodedata.py 2000/10/23 17:22:08 1.4
--- test_unicodedata.py 2001/01/17 19:11:13 1.5
***************
*** 6,9 ****
--- 6,10 ----
"""#"
+ from test_support import verify, verbose
import sha
***************
*** 88,124 ****
print 'API:',
! assert unicodedata.digit(u'A',None) is None
! assert unicodedata.digit(u'9') == 9
! assert unicodedata.digit(u'\u215b',None) is None
! assert unicodedata.digit(u'\u2468') == 9
!
! assert unicodedata.numeric(u'A',None) is None
! assert unicodedata.numeric(u'9') == 9
! assert unicodedata.numeric(u'\u215b') == 0.125
! assert unicodedata.numeric(u'\u2468') == 9.0
!
! assert unicodedata.decimal(u'A',None) is None
! assert unicodedata.decimal(u'9') == 9
! assert unicodedata.decimal(u'\u215b',None) is None
! assert unicodedata.decimal(u'\u2468',None) is None
!
! assert unicodedata.category(u'\uFFFE') == 'Cn'
! assert unicodedata.category(u'a') == 'Ll'
! assert unicodedata.category(u'A') == 'Lu'
!
! assert unicodedata.bidirectional(u'\uFFFE') == ''
! assert unicodedata.bidirectional(u' ') == 'WS'
! assert unicodedata.bidirectional(u'A') == 'L'
!
! assert unicodedata.decomposition(u'\uFFFE') == ''
! assert unicodedata.decomposition(u'\u00bc') == '<fraction> 0031 2044 0034'
!
! assert unicodedata.mirrored(u'\uFFFE') == 0
! assert unicodedata.mirrored(u'a') == 0
! assert unicodedata.mirrored(u'\u2201') == 1
!
! assert unicodedata.combining(u'\uFFFE') == 0
! assert unicodedata.combining(u'a') == 0
! assert unicodedata.combining(u'\u20e1') == 230
print 'ok'
--- 89,125 ----
print 'API:',
! verify(unicodedata.digit(u'A',None) is None)
! verify(unicodedata.digit(u'9') == 9)
! verify(unicodedata.digit(u'\u215b',None) is None)
! verify(unicodedata.digit(u'\u2468') == 9)
!
! verify(unicodedata.numeric(u'A',None) is None)
! verify(unicodedata.numeric(u'9') == 9)
! verify(unicodedata.numeric(u'\u215b') == 0.125)
! verify(unicodedata.numeric(u'\u2468') == 9.0)
!
! verify(unicodedata.decimal(u'A',None) is None)
! verify(unicodedata.decimal(u'9') == 9)
! verify(unicodedata.decimal(u'\u215b',None) is None)
! verify(unicodedata.decimal(u'\u2468',None) is None)
!
! verify(unicodedata.category(u'\uFFFE') == 'Cn')
! verify(unicodedata.category(u'a') == 'Ll')
! verify(unicodedata.category(u'A') == 'Lu')
!
! verify(unicodedata.bidirectional(u'\uFFFE') == '')
! verify(unicodedata.bidirectional(u' ') == 'WS')
! verify(unicodedata.bidirectional(u'A') == 'L')
!
! verify(unicodedata.decomposition(u'\uFFFE') == '')
! verify(unicodedata.decomposition(u'\u00bc') == '<fraction> 0031 2044 0034')
!
! verify(unicodedata.mirrored(u'\uFFFE') == 0)
! verify(unicodedata.mirrored(u'a') == 0)
! verify(unicodedata.mirrored(u'\u2201') == 1)
!
! verify(unicodedata.combining(u'\uFFFE') == 0)
! verify(unicodedata.combining(u'a') == 0)
! verify(unicodedata.combining(u'\u20e1') == 230)
print 'ok'
Index: test_urllib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** test_urllib.py 2000/10/23 17:22:08 1.3
--- test_urllib.py 2001/01/17 19:11:13 1.4
***************
*** 1,3 ****
--- 1,4 ----
# Minimal test of the quote function
+ from test_support import verify, verbose
import urllib
***************
*** 12,18 ****
test = urllib.quote(chars)
! assert test == expected, "urllib.quote problem"
test2 = urllib.unquote(expected)
! assert test2 == chars
in1 = "abc/def"
--- 13,19 ----
test = urllib.quote(chars)
! verify(test == expected, "urllib.quote problem")
test2 = urllib.unquote(expected)
! verify(test2 == chars)
in1 = "abc/def"
***************
*** 20,25 ****
out1_2 = "abc%2fdef"
! assert urllib.quote(in1) == out1_1, "urllib.quote problem"
! assert urllib.quote(in1, '') == out1_2, "urllib.quote problem"
in2 = "abc?def"
--- 21,26 ----
out1_2 = "abc%2fdef"
! verify(urllib.quote(in1) == out1_1, "urllib.quote problem")
! verify(urllib.quote(in1, '') == out1_2, "urllib.quote problem")
in2 = "abc?def"
***************
*** 27,30 ****
out2_2 = "abc?def"
! assert urllib.quote(in2) == out2_1, "urllib.quote problem"
! assert urllib.quote(in2, '?') == out2_2, "urllib.quote problem"
--- 28,31 ----
out2_2 = "abc?def"
! verify(urllib.quote(in2) == out2_1, "urllib.quote problem")
! verify(urllib.quote(in2, '?') == out2_2, "urllib.quote problem")
Index: test_userdict.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userdict.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** test_userdict.py 1999/03/26 15:32:02 1.1
--- test_userdict.py 2001/01/17 19:11:13 1.2
***************
*** 1,4 ****
--- 1,5 ----
# Check every path through every method of UserDict
+ from test_support import verify, verbose
from UserDict import UserDict
***************
*** 21,27 ****
# Test __repr__
! assert str(u0) == str(d0)
! assert repr(u1) == repr(d1)
! assert `u2` == `d2`
# Test __cmp__ and __len__
--- 22,28 ----
# Test __repr__
! verify(str(u0) == str(d0))
! verify(repr(u1) == repr(d1))
! verify(`u2` == `d2`)
# Test __cmp__ and __len__
***************
*** 30,38 ****
for a in all:
for b in all:
! assert cmp(a, b) == cmp(len(a), len(b))
# Test __getitem__
! assert u2["one"] == 1
try:
u1["two"]
--- 31,39 ----
for a in all:
for b in all:
! verify(cmp(a, b) == cmp(len(a), len(b)))
# Test __getitem__
! verify(u2["one"] == 1)
try:
u1["two"]
***************
*** 40,44 ****
pass
else:
! assert 0, "u1['two'] shouldn't exist"
# Test __setitem__
--- 41,45 ----
pass
else:
! verify(0, "u1['two'] shouldn't exist")
# Test __setitem__
***************
*** 56,70 ****
pass
else:
! assert 0, "u3['three'] shouldn't exist"
# Test clear
u3.clear()
! assert u3 == {}
# Test copy()
u2a = u2.copy()
! assert u2a == u2
class MyUserDict(UserDict):
--- 57,71 ----
pass
else:
! verify(0, "u3['three'] shouldn't exist")
# Test clear
u3.clear()
! verify(u3 == {})
# Test copy()
u2a = u2.copy()
! verify(u2a == u2)
class MyUserDict(UserDict):
***************
*** 73,90 ****
m2 = MyUserDict(u2)
m2a = m2.copy()
! assert m2a == m2
# Test keys, items, values
! assert u2.keys() == d2.keys()
! assert u2.items() == d2.items()
! assert u2.values() == d2.values()
# Test has_key
for i in u2.keys():
! assert u2.has_key(i) == 1
! assert u1.has_key(i) == d1.has_key(i)
! assert u0.has_key(i) == d0.has_key(i)
# Test update
--- 74,91 ----
m2 = MyUserDict(u2)
m2a = m2.copy()
! verify(m2a == m2)
# Test keys, items, values
! verify(u2.keys() == d2.keys())
! verify(u2.items() == d2.items())
! verify(u2.values() == d2.values())
# Test has_key
for i in u2.keys():
! verify(u2.has_key(i) == 1)
! verify(u1.has_key(i) == d1.has_key(i))
! verify(u0.has_key(i) == d0.has_key(i))
# Test update
***************
*** 92,101 ****
t = UserDict()
t.update(u2)
! assert t == u2
# Test get
for i in u2.keys():
! assert u2.get(i) == u2[i]
! assert u1.get(i) == d1.get(i)
! assert u0.get(i) == d0.get(i)
--- 93,102 ----
t = UserDict()
t.update(u2)
! verify(t == u2)
# Test get
for i in u2.keys():
! verify(u2.get(i) == u2[i])
! verify(u1.get(i) == d1.get(i))
! verify(u0.get(i) == d0.get(i))
Index: test_userlist.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userlist.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** test_userlist.py 2000/09/19 20:31:24 1.3
--- test_userlist.py 2001/01/17 19:11:13 1.4
***************
*** 4,8 ****
from test_support import TestFailed
! # Use check instead of assert so -O doesn't render the
# test useless.
def check(predicate, msg):
--- 4,8 ----
from test_support import TestFailed
! # Use check instead of verify(so -O doesn't render the)
# test useless.
def check(predicate, msg):
Index: test_userstring.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userstring.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** test_userstring.py 2000/07/10 17:08:42 1.2
--- test_userstring.py 2001/01/17 19:11:13 1.3
***************
*** 1,5 ****
#!/usr/bin/env python
import sys, string
! from test_support import verbose
import string_tests
# UserString is a wrapper around the native builtin string type.
--- 1,5 ----
#!/usr/bin/env python
import sys, string
! from test_support import verify, verbose
import string_tests
# UserString is a wrapper around the native builtin string type.
Index: test_winreg.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_winreg.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** test_winreg.py 2000/10/23 17:22:08 1.7
--- test_winreg.py 2001/01/17 19:11:13 1.8
***************
*** 32,40 ****
# Check we wrote as many items as we thought.
nkeys, nvalues, since_mod = QueryInfoKey(key)
! assert nkeys==1, "Not the correct number of sub keys"
! assert nvalues==1, "Not the correct number of values"
nkeys, nvalues, since_mod = QueryInfoKey(sub_key)
! assert nkeys==0, "Not the correct number of sub keys"
! assert nvalues==len(test_data), "Not the correct number of values"
# Close this key this way...
# (but before we do, copy the key as an integer - this allows
--- 32,40 ----
# Check we wrote as many items as we thought.
nkeys, nvalues, since_mod = QueryInfoKey(key)
! verify(nkeys==1, "Not the correct number of sub keys")
! verify(nvalues==1, "Not the correct number of values")
nkeys, nvalues, since_mod = QueryInfoKey(sub_key)
! verify(nkeys==0, "Not the correct number of sub keys")
! verify(nvalues==len(test_data), "Not the correct number of values")
# Close this key this way...
# (but before we do, copy the key as an integer - this allows
***************
*** 59,63 ****
# Check we can get default value for this key.
val = QueryValue(root_key, test_key_name)
! assert val=="Default value", "Registry didn't give back the correct value"
key = OpenKey(root_key, test_key_name)
--- 59,63 ----
# Check we can get default value for this key.
val = QueryValue(root_key, test_key_name)
! verify(val=="Default value", "Registry didn't give back the correct value")
key = OpenKey(root_key, test_key_name)
***************
*** 71,89 ****
except EnvironmentError:
break
! assert data in test_data, "Didn't read back the correct test data"
index = index + 1
! assert index==len(test_data), "Didn't read the correct number of items"
# Check I can directly access each item
for value_name, value_data, value_type in test_data:
read_val, read_typ = QueryValueEx(sub_key, value_name)
! assert read_val==value_data and read_typ == value_type, \
! "Could not directly read the value"
sub_key.Close()
# Enumerate our main key.
read_val = EnumKey(key, 0)
! assert read_val == "sub_key", "Read subkey value wrong"
try:
EnumKey(key, 1)
! assert 0, "Was able to get a second key when I only have one!"
except EnvironmentError:
pass
--- 71,89 ----
except EnvironmentError:
break
! verify(data in test_data, "Didn't read back the correct test data")
index = index + 1
! verify(index==len(test_data), "Didn't read the correct number of items")
# Check I can directly access each item
for value_name, value_data, value_type in test_data:
read_val, read_typ = QueryValueEx(sub_key, value_name)
! verify(read_val==value_data and read_typ == value_type, \
! "Could not directly read the value" )
sub_key.Close()
# Enumerate our main key.
read_val = EnumKey(key, 0)
! verify(read_val == "sub_key", "Read subkey value wrong")
try:
EnumKey(key, 1)
! verify(0, "Was able to get a second key when I only have one!")
except EnvironmentError:
pass
***************
*** 101,105 ****
nkeys, nvalues, since_mod = QueryInfoKey(sub_key)
! assert nkeys==0 and nvalues==0, "subkey not empty before delete"
sub_key.Close()
DeleteKey(key, "sub_key")
--- 101,105 ----
nkeys, nvalues, since_mod = QueryInfoKey(sub_key)
! verify(nkeys==0 and nvalues==0, "subkey not empty before delete")
sub_key.Close()
DeleteKey(key, "sub_key")
***************
*** 108,112 ****
# Shouldnt be able to delete it twice!
DeleteKey(key, "sub_key")
! assert 0, "Deleting the key twice succeeded"
except EnvironmentError:
pass
--- 108,112 ----
# Shouldnt be able to delete it twice!
DeleteKey(key, "sub_key")
! verify(0, "Deleting the key twice succeeded")
except EnvironmentError:
pass
***************
*** 116,120 ****
try:
key = OpenKey(root_key, test_key_name)
! assert 0, "Could open the non-existent key"
except WindowsError: # Use this error name this time
pass
--- 116,120 ----
try:
key = OpenKey(root_key, test_key_name)
! verify(0, "Could open the non-existent key")
except WindowsError: # Use this error name this time
pass
Index: test_xmllib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_xmllib.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** test_xmllib.py 2000/10/23 17:22:08 1.2
--- test_xmllib.py 2001/01/17 19:11:13 1.3
***************
*** 3,7 ****
'''
! from test_support import verbose
testdoc = """\
--- 3,7 ----
'''
! from test_support import verify, verbose
testdoc = """\