mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +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
|
@ -83,18 +83,18 @@ x = 3.1e4
|
|||
|
||||
print '1.1.3 String literals'
|
||||
|
||||
##def assert(s):
|
||||
##def verify(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 = ''; 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'
|
||||
assert(len(x) == 24 and x == y)
|
||||
verify(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)
|
||||
verify(len(x) == 24 and x == y)
|
||||
x = """
|
||||
The "quick"
|
||||
brown fox
|
||||
|
@ -102,25 +102,25 @@ jumps over
|
|||
the 'lazy' dog.
|
||||
"""
|
||||
y = '\nThe "quick"\nbrown fox\njumps over\nthe \'lazy\' dog.\n'
|
||||
assert(x == y)
|
||||
verify(x == y)
|
||||
y = '''
|
||||
The "quick"
|
||||
brown fox
|
||||
jumps over
|
||||
the 'lazy' dog.
|
||||
'''; assert(x == y)
|
||||
'''; verify(x == y)
|
||||
y = "\n\
|
||||
The \"quick\"\n\
|
||||
brown fox\n\
|
||||
jumps over\n\
|
||||
the 'lazy' dog.\n\
|
||||
"; assert(x == y)
|
||||
"; verify(x == y)
|
||||
y = '\n\
|
||||
The \"quick\"\n\
|
||||
brown fox\n\
|
||||
jumps over\n\
|
||||
the \'lazy\' dog.\n\
|
||||
'; assert(x == y)
|
||||
'; verify(x == y)
|
||||
|
||||
|
||||
print '1.2 Grammar'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue