mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Whitespace normalization.
This commit is contained in:
parent
f805cd2c1f
commit
f2715e0764
26 changed files with 110 additions and 114 deletions
|
@ -214,4 +214,3 @@ def test_main(verbose=None):
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main(verbose=True)
|
test_main(verbose=True)
|
||||||
|
|
||||||
|
|
|
@ -352,10 +352,10 @@ class BuiltinTest(unittest.TestCase):
|
||||||
filter(identity, Squares(5))
|
filter(identity, Squares(5))
|
||||||
self.assertRaises(TypeError, filter)
|
self.assertRaises(TypeError, filter)
|
||||||
class BadSeq(object):
|
class BadSeq(object):
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
if index<4:
|
if index<4:
|
||||||
return 42
|
return 42
|
||||||
raise ValueError
|
raise ValueError
|
||||||
self.assertRaises(ValueError, filter, lambda x: x, BadSeq())
|
self.assertRaises(ValueError, filter, lambda x: x, BadSeq())
|
||||||
def badfunc():
|
def badfunc():
|
||||||
pass
|
pass
|
||||||
|
@ -441,13 +441,13 @@ class BuiltinTest(unittest.TestCase):
|
||||||
|
|
||||||
for (cls, inps) in inputs.iteritems():
|
for (cls, inps) in inputs.iteritems():
|
||||||
for (inp, exp) in inps.iteritems():
|
for (inp, exp) in inps.iteritems():
|
||||||
# make sure the output goes through __getitem__
|
# make sure the output goes through __getitem__
|
||||||
# even if func is None
|
# even if func is None
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
filter(funcs[0], cls(inp)),
|
filter(funcs[0], cls(inp)),
|
||||||
filter(funcs[1], cls(inp))
|
filter(funcs[1], cls(inp))
|
||||||
)
|
)
|
||||||
for func in funcs:
|
for func in funcs:
|
||||||
outp = filter(func, cls(inp))
|
outp = filter(func, cls(inp))
|
||||||
self.assertEqual(outp, exp)
|
self.assertEqual(outp, exp)
|
||||||
self.assert_(not isinstance(outp, cls))
|
self.assert_(not isinstance(outp, cls))
|
||||||
|
@ -1039,10 +1039,10 @@ class BuiltinTest(unittest.TestCase):
|
||||||
self.assertRaises(TypeError, round)
|
self.assertRaises(TypeError, round)
|
||||||
|
|
||||||
def test_setattr(self):
|
def test_setattr(self):
|
||||||
setattr(sys, 'spam', 1)
|
setattr(sys, 'spam', 1)
|
||||||
self.assertEqual(sys.spam, 1)
|
self.assertEqual(sys.spam, 1)
|
||||||
self.assertRaises(TypeError, setattr, sys, 1, 'spam')
|
self.assertRaises(TypeError, setattr, sys, 1, 'spam')
|
||||||
self.assertRaises(TypeError, setattr)
|
self.assertRaises(TypeError, setattr)
|
||||||
|
|
||||||
def test_str(self):
|
def test_str(self):
|
||||||
self.assertEqual(str(''), '')
|
self.assertEqual(str(''), '')
|
||||||
|
|
|
@ -11,7 +11,7 @@ class PosReturn:
|
||||||
oldpos = self.pos
|
oldpos = self.pos
|
||||||
realpos = oldpos
|
realpos = oldpos
|
||||||
if realpos<0:
|
if realpos<0:
|
||||||
realpos = len(exc.object) + realpos
|
realpos = len(exc.object) + realpos
|
||||||
# if we don't advance this time, terminate on the next call
|
# if we don't advance this time, terminate on the next call
|
||||||
# otherwise we'd get an endless loop
|
# otherwise we'd get an endless loop
|
||||||
if realpos <= exc.start:
|
if realpos <= exc.start:
|
||||||
|
@ -532,7 +532,7 @@ class CodecCallbackTest(unittest.TestCase):
|
||||||
# and inline implementations
|
# and inline implementations
|
||||||
v = (1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 50000)
|
v = (1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 50000)
|
||||||
if sys.maxunicode>=100000:
|
if sys.maxunicode>=100000:
|
||||||
v += (100000, 500000, 1000000)
|
v += (100000, 500000, 1000000)
|
||||||
s = u"".join([unichr(x) for x in v])
|
s = u"".join([unichr(x) for x in v])
|
||||||
codecs.register_error("test.xmlcharrefreplace", codecs.xmlcharrefreplace_errors)
|
codecs.register_error("test.xmlcharrefreplace", codecs.xmlcharrefreplace_errors)
|
||||||
for enc in ("ascii", "iso-8859-15"):
|
for enc in ("ascii", "iso-8859-15"):
|
||||||
|
|
|
@ -103,9 +103,9 @@ class TestTZInfo(unittest.TestCase):
|
||||||
orig = tzinfo.__new__(tzinfo)
|
orig = tzinfo.__new__(tzinfo)
|
||||||
self.failUnless(type(orig) is tzinfo)
|
self.failUnless(type(orig) is tzinfo)
|
||||||
for pickler, unpickler, proto in pickle_choices:
|
for pickler, unpickler, proto in pickle_choices:
|
||||||
green = pickler.dumps(orig, proto)
|
green = pickler.dumps(orig, proto)
|
||||||
derived = unpickler.loads(green)
|
derived = unpickler.loads(green)
|
||||||
self.failUnless(type(derived) is tzinfo)
|
self.failUnless(type(derived) is tzinfo)
|
||||||
|
|
||||||
def test_pickling_subclass(self):
|
def test_pickling_subclass(self):
|
||||||
# Make sure we can pickle/unpickle an instance of a subclass.
|
# Make sure we can pickle/unpickle an instance of a subclass.
|
||||||
|
@ -116,12 +116,12 @@ class TestTZInfo(unittest.TestCase):
|
||||||
self.assertEqual(orig.utcoffset(None), offset)
|
self.assertEqual(orig.utcoffset(None), offset)
|
||||||
self.assertEqual(orig.tzname(None), 'cookie')
|
self.assertEqual(orig.tzname(None), 'cookie')
|
||||||
for pickler, unpickler, proto in pickle_choices:
|
for pickler, unpickler, proto in pickle_choices:
|
||||||
green = pickler.dumps(orig, proto)
|
green = pickler.dumps(orig, proto)
|
||||||
derived = unpickler.loads(green)
|
derived = unpickler.loads(green)
|
||||||
self.failUnless(isinstance(derived, tzinfo))
|
self.failUnless(isinstance(derived, tzinfo))
|
||||||
self.failUnless(type(derived) is PicklableFixedOffset)
|
self.failUnless(type(derived) is PicklableFixedOffset)
|
||||||
self.assertEqual(derived.utcoffset(None), offset)
|
self.assertEqual(derived.utcoffset(None), offset)
|
||||||
self.assertEqual(derived.tzname(None), 'cookie')
|
self.assertEqual(derived.tzname(None), 'cookie')
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# Base clase for testing a particular aspect of timedelta, time, date and
|
# Base clase for testing a particular aspect of timedelta, time, date and
|
||||||
|
@ -517,8 +517,8 @@ class TestDate(HarmlessMixedComparison):
|
||||||
fromord = self.theclass.fromordinal(n)
|
fromord = self.theclass.fromordinal(n)
|
||||||
self.assertEqual(d, fromord)
|
self.assertEqual(d, fromord)
|
||||||
if hasattr(fromord, "hour"):
|
if hasattr(fromord, "hour"):
|
||||||
# if we're checking something fancier than a date, verify
|
# if we're checking something fancier than a date, verify
|
||||||
# the extra fields have been zeroed out
|
# the extra fields have been zeroed out
|
||||||
self.assertEqual(fromord.hour, 0)
|
self.assertEqual(fromord.hour, 0)
|
||||||
self.assertEqual(fromord.minute, 0)
|
self.assertEqual(fromord.minute, 0)
|
||||||
self.assertEqual(fromord.second, 0)
|
self.assertEqual(fromord.second, 0)
|
||||||
|
|
|
@ -3,7 +3,7 @@ import locale
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
raise TestSkipped("Locale support on MacOSX is minimal and cannot be tested")
|
raise TestSkipped("Locale support on MacOSX is minimal and cannot be tested")
|
||||||
oldlocale = locale.setlocale(locale.LC_NUMERIC)
|
oldlocale = locale.setlocale(locale.LC_NUMERIC)
|
||||||
|
|
||||||
tloc = "en_US"
|
tloc = "en_US"
|
||||||
|
|
|
@ -82,4 +82,3 @@ for prec in range(100):
|
||||||
else:
|
else:
|
||||||
#print result
|
#print result
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -127,18 +127,18 @@ class SysModuleTest(unittest.TestCase):
|
||||||
# testing sys.setprofile() is done in test_profile.py
|
# testing sys.setprofile() is done in test_profile.py
|
||||||
|
|
||||||
def test_setcheckinterval(self):
|
def test_setcheckinterval(self):
|
||||||
self.assertRaises(TypeError, sys.setcheckinterval)
|
self.assertRaises(TypeError, sys.setcheckinterval)
|
||||||
sys.setcheckinterval(120)
|
sys.setcheckinterval(120)
|
||||||
sys.setcheckinterval(100)
|
sys.setcheckinterval(100)
|
||||||
|
|
||||||
def test_recursionlimit(self):
|
def test_recursionlimit(self):
|
||||||
self.assertRaises(TypeError, sys.getrecursionlimit, 42)
|
self.assertRaises(TypeError, sys.getrecursionlimit, 42)
|
||||||
oldlimit = sys.getrecursionlimit()
|
oldlimit = sys.getrecursionlimit()
|
||||||
self.assertRaises(TypeError, sys.setrecursionlimit)
|
self.assertRaises(TypeError, sys.setrecursionlimit)
|
||||||
self.assertRaises(ValueError, sys.setrecursionlimit, -42)
|
self.assertRaises(ValueError, sys.setrecursionlimit, -42)
|
||||||
sys.setrecursionlimit(10000)
|
sys.setrecursionlimit(10000)
|
||||||
self.assertEqual(sys.getrecursionlimit(), 10000)
|
self.assertEqual(sys.getrecursionlimit(), 10000)
|
||||||
sys.setrecursionlimit(oldlimit)
|
sys.setrecursionlimit(oldlimit)
|
||||||
|
|
||||||
def test_getwindowsversion(self):
|
def test_getwindowsversion(self):
|
||||||
if hasattr(sys, "getwindowsversion"):
|
if hasattr(sys, "getwindowsversion"):
|
||||||
|
|
|
@ -21,6 +21,7 @@ def path(path):
|
||||||
return test_support.findfile(path)
|
return test_support.findfile(path)
|
||||||
|
|
||||||
testtar = path("testtar.tar")
|
testtar = path("testtar.tar")
|
||||||
|
print testtar
|
||||||
tempdir = path("testtar.dir")
|
tempdir = path("testtar.dir")
|
||||||
tempname = path("testtar.tmp")
|
tempname = path("testtar.tmp")
|
||||||
membercount = 10
|
membercount = 10
|
||||||
|
|
|
@ -258,4 +258,3 @@ def test_main():
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ def test_main():
|
||||||
for test in (DumpCPickle_LoadPickle,
|
for test in (DumpCPickle_LoadPickle,
|
||||||
DumpPickle_LoadCPickle,
|
DumpPickle_LoadCPickle,
|
||||||
):
|
):
|
||||||
suite.addTest(unittest.makeSuite(test))
|
suite.addTest(unittest.makeSuite(test))
|
||||||
test_support.run_suite(suite)
|
test_support.run_suite(suite)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -16,11 +16,11 @@ import zipimport
|
||||||
def make_pyc(co, mtime):
|
def make_pyc(co, mtime):
|
||||||
data = marshal.dumps(co)
|
data = marshal.dumps(co)
|
||||||
if type(mtime) is type(0.0):
|
if type(mtime) is type(0.0):
|
||||||
# Mac mtimes need a bit of special casing
|
# Mac mtimes need a bit of special casing
|
||||||
if mtime < 0x7fffffff:
|
if mtime < 0x7fffffff:
|
||||||
mtime = int(mtime)
|
mtime = int(mtime)
|
||||||
else:
|
else:
|
||||||
mtime = int(-0x100000000L + long(mtime))
|
mtime = int(-0x100000000L + long(mtime))
|
||||||
pyc = imp.get_magic() + struct.pack("<i", int(mtime)) + data
|
pyc = imp.get_magic() + struct.pack("<i", int(mtime)) + data
|
||||||
return pyc
|
return pyc
|
||||||
|
|
||||||
|
|
|
@ -506,4 +506,3 @@ if False:
|
||||||
su = ut.TestSuite()
|
su = ut.TestSuite()
|
||||||
su.addTest(ut.makeSuite(tz.CompressTestCase))
|
su.addTest(ut.makeSuite(tz.CompressTestCase))
|
||||||
ts.run_suite(su)
|
ts.run_suite(su)
|
||||||
|
|
||||||
|
|
|
@ -129,17 +129,17 @@ bar \\ baz
|
||||||
if 1:
|
if 1:
|
||||||
x = 2
|
x = 2
|
||||||
if 1:
|
if 1:
|
||||||
x = 2
|
x = 2
|
||||||
if 1:
|
if 1:
|
||||||
while 0:
|
while 0:
|
||||||
if 0:
|
if 0:
|
||||||
x = 2
|
x = 2
|
||||||
x = 2
|
x = 2
|
||||||
if 0:
|
if 0:
|
||||||
if 2:
|
if 2:
|
||||||
while 0:
|
while 0:
|
||||||
if 1:
|
if 1:
|
||||||
x = 2
|
x = 2
|
||||||
|
|
||||||
# Operators
|
# Operators
|
||||||
|
|
||||||
|
@ -172,4 +172,3 @@ x = -1*1/1 + 1*1 - ---1*1
|
||||||
# selector
|
# selector
|
||||||
import sys, time
|
import sys, time
|
||||||
x = sys.modules['time'].time()
|
x = sys.modules['time'].time()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue