mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
8551dd6078
commit
3661908a6a
70 changed files with 436 additions and 412 deletions
|
@ -18,13 +18,13 @@ data2 = """/* zlibmodule.c -- gzip-compatible data compression */
|
|||
f = gzip.GzipFile(filename, 'wb') ; f.write(data1 * 50) ; f.close()
|
||||
|
||||
f = gzip.GzipFile(filename, 'rb') ; d = f.read() ; f.close()
|
||||
assert d == data1*50
|
||||
verify(d == data1*50)
|
||||
|
||||
# Append to the previous file
|
||||
f = gzip.GzipFile(filename, 'ab') ; f.write(data2 * 15) ; f.close()
|
||||
|
||||
f = gzip.GzipFile(filename, 'rb') ; d = f.read() ; f.close()
|
||||
assert d == (data1*50) + (data2*15)
|
||||
verify(d == (data1*50) + (data2*15))
|
||||
|
||||
# Try .readline() with varying line lengths
|
||||
|
||||
|
@ -33,7 +33,7 @@ line_length = 0
|
|||
while 1:
|
||||
L = f.readline( line_length )
|
||||
if L == "" and line_length != 0: break
|
||||
assert len(L) <= line_length
|
||||
verify(len(L) <= line_length)
|
||||
line_length = (line_length + 1) % 50
|
||||
f.close()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue