mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Whitespace normalization. Leaving tokenize_tests.py alone for now.
This commit is contained in:
parent
be4cbb1668
commit
d2bf3b7ca6
9 changed files with 41 additions and 44 deletions
|
@ -41,4 +41,3 @@ except UnicodeError:
|
|||
print '\\001 maps to undefined: OK'
|
||||
else:
|
||||
print '*** check failed: \\001 does not map to undefined'
|
||||
|
||||
|
|
|
@ -198,4 +198,3 @@ test_exc('abc %a', 1, ValueError,
|
|||
"unsupported format character 'a' (0x61) at index 5")
|
||||
test_exc(u'abc %\u3000', 1, ValueError,
|
||||
"unsupported format character '?' (0x3000) at index 5")
|
||||
|
||||
|
|
|
@ -74,12 +74,12 @@ def findfile(file, here=__file__):
|
|||
|
||||
def verify(condition, reason='test failed'):
|
||||
|
||||
""" Verify that condition is true. If not, raise an
|
||||
AssertionError.
|
||||
""" Verify that condition is true. If not, raise an
|
||||
AssertionError.
|
||||
|
||||
The optinal argument reason can be given to provide
|
||||
a better error text.
|
||||
The optinal argument reason can be given to provide
|
||||
a better error text.
|
||||
|
||||
"""
|
||||
if not condition:
|
||||
raise AssertionError,reason
|
||||
"""
|
||||
if not condition:
|
||||
raise AssertionError,reason
|
||||
|
|
|
@ -195,7 +195,7 @@ if 0:
|
|||
|
||||
# Non surrogate above surrogate value, fixup required
|
||||
def test_lecmp(s, s2):
|
||||
verify(s < s2 , "comparison failed on %s < %s" % (s, s2))
|
||||
verify(s < s2 , "comparison failed on %s < %s" % (s, s2))
|
||||
|
||||
def test_fixup(s):
|
||||
s2 = u'\ud800\udc01'
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
from test_support import verbose
|
||||
|
||||
class XReader:
|
||||
def __init__(self):
|
||||
self.count = 5
|
||||
def __init__(self):
|
||||
self.count = 5
|
||||
|
||||
def readlines(self, sizehint = None):
|
||||
self.count = self.count - 1
|
||||
return map(lambda x: "%d\n" % x, range(self.count))
|
||||
def readlines(self, sizehint = None):
|
||||
self.count = self.count - 1
|
||||
return map(lambda x: "%d\n" % x, range(self.count))
|
||||
|
||||
class Null: pass
|
||||
|
||||
|
@ -16,28 +16,28 @@ import xreadlines
|
|||
lineno = 0
|
||||
|
||||
try:
|
||||
xreadlines.xreadlines(Null())[0]
|
||||
xreadlines.xreadlines(Null())[0]
|
||||
except AttributeError, detail:
|
||||
print "AttributeError (expected)"
|
||||
print "AttributeError (expected)"
|
||||
else:
|
||||
print "Did not throw attribute error"
|
||||
print "Did not throw attribute error"
|
||||
|
||||
try:
|
||||
xreadlines.xreadlines(XReader)[0]
|
||||
xreadlines.xreadlines(XReader)[0]
|
||||
except TypeError, detail:
|
||||
print "TypeError (expected)"
|
||||
print "TypeError (expected)"
|
||||
else:
|
||||
print "Did not throw type error"
|
||||
print "Did not throw type error"
|
||||
|
||||
try:
|
||||
xreadlines.xreadlines(XReader())[1]
|
||||
xreadlines.xreadlines(XReader())[1]
|
||||
except RuntimeError, detail:
|
||||
print "RuntimeError (expected):", detail
|
||||
print "RuntimeError (expected):", detail
|
||||
else:
|
||||
print "Did not throw runtime error"
|
||||
print "Did not throw runtime error"
|
||||
|
||||
xresult = ['0\n', '1\n', '2\n', '3\n', '0\n', '1\n', '2\n', '0\n', '1\n', '0\n']
|
||||
for line in xreadlines.xreadlines(XReader()):
|
||||
if line != xresult[lineno]:
|
||||
print "line %d differs" % lineno
|
||||
lineno += 1
|
||||
if line != xresult[lineno]:
|
||||
print "line %d differs" % lineno
|
||||
lineno += 1
|
||||
|
|
|
@ -46,4 +46,3 @@ decoding_map.update({
|
|||
encoding_map = {}
|
||||
for k,v in decoding_map.items():
|
||||
encoding_map[v] = k
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue