Commit 3de75266 authored by Tim Peters's avatar Tim Peters

Whitespace normalization.

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