Kaydet (Commit) 3de75266 authored tarafından Tim Peters's avatar Tim Peters

Whitespace normalization.

üst e7130315
......@@ -470,8 +470,8 @@ try: int('1' * 600)
except: raise TestFailed("int('1' * 600) didn't return long")
if have_unicode:
try: int(unichr(0x661) * 600)
except: raise TestFailed("int('\\u0661' * 600) didn't return long")
try: int(unichr(0x661) * 600)
except: raise TestFailed("int('\\u0661' * 600) didn't return long")
try: int(1, 12)
except TypeError: pass
......@@ -539,17 +539,17 @@ if sys.maxint == 0x7fffffff:
# XXX If/when PySequence_Length() returns a ssize_t, it should be
# XXX re-enabled.
try:
# Verify clearing of bug #556025.
# This assumes that the max data size (sys.maxint) == max
# address size this also assumes that the address size is at
# least 4 bytes with 8 byte addresses, the bug is not well
# tested
#
# Note: This test is expected to SEGV under Cygwin 1.3.12 or
# earlier due to a newlib bug. See the following mailing list
# thread for the details:
# http://sources.redhat.com/ml/newlib/2002/msg00369.html
# Verify clearing of bug #556025.
# This assumes that the max data size (sys.maxint) == max
# address size this also assumes that the address size is at
# least 4 bytes with 8 byte addresses, the bug is not well
# tested
#
# Note: This test is expected to SEGV under Cygwin 1.3.12 or
# earlier due to a newlib bug. See the following mailing list
# thread for the details:
# http://sources.redhat.com/ml/newlib/2002/msg00369.html
list(xrange(sys.maxint // 2))
except MemoryError:
pass
......
This diff is collapsed.
......@@ -213,10 +213,10 @@ class CodecCallbackTest(unittest.TestCase):
for uni in [ s*l for s in (u"x", u"\u3042", u"a\xe4") ]:
for enc in ("ascii", "latin-1", "iso-8859-1", "iso-8859-15", "utf-8", "utf-7", "utf-16"):
for err in errors:
try:
uni.encode(enc, err)
except UnicodeError:
pass
try:
uni.encode(enc, err)
except UnicodeError:
pass
def check_exceptionobjectargs(self, exctype, args, msg):
# Test UnicodeError subclasses: construction, attribute assignment and __str__ conversion
......@@ -229,7 +229,7 @@ class CodecCallbackTest(unittest.TestCase):
for i in xrange(len(args)):
for wrongarg in wrongargs:
if type(wrongarg) is type(args[i]):
continue
continue
# build argument array
callargs = []
for j in xrange(len(args)):
......
......@@ -52,10 +52,10 @@ class UnicodeFileTests(unittest.TestCase):
% (fn.__name__, filename))
except expected_exception, details:
if check_fn_in_exception and details.filename != filename:
raise TestFailed("Function '%s(%r) failed with "
"bad filename in the exception: %r"
% (fn.__name__, filename,
details.filename))
raise TestFailed("Function '%s(%r) failed with "
"bad filename in the exception: %r"
% (fn.__name__, filename,
details.filename))
def test_failures(self):
# Pass non-existing Unicode filenames all over the place.
......
......@@ -446,10 +446,10 @@ class TestSubsetEmptyNonEmpty(TestSubsets):
#------------------------------------------------------------------------------
class TestSubsetPartial(TestSubsets):
left = Set([1])
right = Set([1, 2])
name = "one a non-empty proper subset of other"
cases = "!=", "<", "<="
left = Set([1])
right = Set([1, 2])
name = "one a non-empty proper subset of other"
cases = "!=", "<", "<="
#------------------------------------------------------------------------------
......
......@@ -109,7 +109,7 @@ except IOError:
TESTFN = TMP_TESTFN
del TMP_TESTFN
except IOError:
print ('WARNING: tests will fail, unable to write to: %s or %s' %
print ('WARNING: tests will fail, unable to write to: %s or %s' %
(TESTFN, TMP_TESTFN))
if fp is not None:
fp.close()
......
......@@ -107,7 +107,7 @@ def _settrace_and_return(tracefunc):
sys._getframe().f_back.f_trace = tracefunc
def settrace_and_return(tracefunc):
_settrace_and_return(tracefunc)
settrace_and_return.events = [(1, 'return')]
def _settrace_and_raise(tracefunc):
......@@ -119,7 +119,7 @@ def settrace_and_raise(tracefunc):
_settrace_and_raise(tracefunc)
except RuntimeError, exc:
pass
settrace_and_raise.events = [(2, 'exception'),
(3, 'line'),
(4, 'line'),
......@@ -134,14 +134,14 @@ class Tracer:
class TraceTestCase(unittest.TestCase):
def compare_events(self, line_offset, events, expected_events):
events = [(l - line_offset, e) for (l, e) in events]
events = [(l - line_offset, e) for (l, e) in events]
if events != expected_events:
self.fail(
"events did not match expectation:\n" +
"\n".join(difflib.ndiff(map(str, expected_events),
map(str, events))))
def run_test(self, func):
tracer = Tracer()
sys.settrace(tracer.trace)
......@@ -156,7 +156,7 @@ class TraceTestCase(unittest.TestCase):
sys.settrace(None)
self.compare_events(func.func_code.co_firstlineno,
tracer.events, func.events)
def test_1_basic(self):
self.run_test(basic)
def test_2_arigo(self):
......@@ -185,7 +185,7 @@ class RaisingTraceFuncTestCase(unittest.TestCase):
raise ValueError # just something that isn't RuntimeError
else:
return self.trace
def f(self):
"""The function to trace; raises an exception if that's the case
we're testing, so that the 'exception' trace event fires."""
......@@ -194,7 +194,7 @@ class RaisingTraceFuncTestCase(unittest.TestCase):
y = 1/x
else:
return 1
def run_test_for_event(self, event):
"""Tests that an exception raised in response to the given event is
handled OK."""
......@@ -210,7 +210,7 @@ class RaisingTraceFuncTestCase(unittest.TestCase):
self.fail("exception not thrown!")
except RuntimeError:
self.fail("recursion counter not reset")
# Test the handling of exceptions raised by each kind of trace event.
def test_call(self):
self.run_test_for_event('call')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment