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