diff options
Diffstat (limited to 'Lib/test')
-rwxr-xr-x | Lib/test/re_tests.py | 2 | ||||
-rwxr-xr-x | Lib/test/regrtest.py | 2 | ||||
-rwxr-xr-x | Lib/test/test_aepack.py | 6 | ||||
-rw-r--r-- | Lib/test/test_bisect.py | 1 | ||||
-rw-r--r-- | Lib/test/test_builtin.py | 30 | ||||
-rw-r--r-- | Lib/test/test_codeccallbacks.py | 4 | ||||
-rw-r--r-- | Lib/test/test_datetime.py | 22 | ||||
-rw-r--r-- | Lib/test/test_descr.py | 2 | ||||
-rw-r--r-- | Lib/test/test_dummy_thread.py | 10 | ||||
-rw-r--r-- | Lib/test/test_dummy_threading.py | 4 | ||||
-rw-r--r-- | Lib/test/test_locale.py | 2 | ||||
-rw-r--r-- | Lib/test/test_macfs.py | 18 | ||||
-rw-r--r-- | Lib/test/test_macostools.py | 14 | ||||
-rw-r--r-- | Lib/test/test_parser.py | 2 | ||||
-rw-r--r-- | Lib/test/test_string.py | 1 | ||||
-rw-r--r-- | Lib/test/test_sys.py | 20 | ||||
-rw-r--r-- | Lib/test/test_tarfile.py | 1 | ||||
-rw-r--r-- | Lib/test/test_userlist.py | 1 | ||||
-rw-r--r-- | Lib/test/test_xpickle.py | 2 | ||||
-rw-r--r-- | Lib/test/test_zipimport.py | 10 | ||||
-rw-r--r-- | Lib/test/test_zlib.py | 3 | ||||
-rw-r--r-- | Lib/test/tokenize_tests.py | 19 |
22 files changed, 86 insertions, 90 deletions
diff --git a/Lib/test/re_tests.py b/Lib/test/re_tests.py index 7ab8eb9..12ad201 100755 --- a/Lib/test/re_tests.py +++ b/Lib/test/re_tests.py @@ -553,7 +553,7 @@ tests = [ # escaping with \ as we know it ('(?<!\\\):(.*?)(?<!\\\):', 'a:bc\\:de:f', SUCCEED, 'g1', 'bc\\:de' ), # terminating with ' and escaping with ? as in edifact - ("(?<!\\?)'(.*?)(?<!\\?)'", "a'bc?'de'f", SUCCEED, 'g1', "bc?'de" ), + ("(?<!\\?)'(.*?)(?<!\\?)'", "a'bc?'de'f", SUCCEED, 'g1', "bc?'de" ), # Comments using the (?#...) syntax diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 5349064..6848367 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -933,7 +933,7 @@ class _ExpectedSkips: if sys.platform != "win32": self.expected.add("test_winreg") self.expected.add("test_winsound") - + self.valid = True def isvalid(self): diff --git a/Lib/test/test_aepack.py b/Lib/test/test_aepack.py index 70b89de..8a4b035 100755 --- a/Lib/test/test_aepack.py +++ b/Lib/test/test_aepack.py @@ -53,7 +53,7 @@ class TestAepack(unittest.TestCase): packed = aepack.pack(o) unpacked = aepack.unpack(packed) self.assertEqual(repr(o), repr(unpacked)) - + def test_roundtrip_FSSpec(self): try: import Carbon.File @@ -72,9 +72,9 @@ class TestAepack(unittest.TestCase): o = Carbon.File.FSSpec(os.curdir).NewAliasMinimal() packed = aepack.pack(o) unpacked = aepack.unpack(packed) - self.assertEqual(o.FSResolveAlias(None)[0].as_pathname(), + self.assertEqual(o.FSResolveAlias(None)[0].as_pathname(), unpacked.FSResolveAlias(None)[0].as_pathname()) - + def test_main(): test_support.run_unittest(TestAepack) diff --git a/Lib/test/test_bisect.py b/Lib/test/test_bisect.py index 076e818..7357f53 100644 --- a/Lib/test/test_bisect.py +++ b/Lib/test/test_bisect.py @@ -214,4 +214,3 @@ def test_main(verbose=None): if __name__ == "__main__": test_main(verbose=True) - diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index f52d9c6..af497a0 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -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(''), '') diff --git a/Lib/test/test_codeccallbacks.py b/Lib/test/test_codeccallbacks.py index bf583c2..f7a07ee 100644 --- a/Lib/test/test_codeccallbacks.py +++ b/Lib/test/test_codeccallbacks.py @@ -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"): diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py index 08b63ed..9532a2a 100644 --- a/Lib/test/test_datetime.py +++ b/Lib/test/test_datetime.py @@ -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) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index ffd86bc..5d15966 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -1837,7 +1837,7 @@ def specials(): def __str__(self): if not self: return 'EPS' - return self + return self # sys.stdout needs to be the original to trigger the recursion bug import sys diff --git a/Lib/test/test_dummy_thread.py b/Lib/test/test_dummy_thread.py index 3be3931..7be430c 100644 --- a/Lib/test/test_dummy_thread.py +++ b/Lib/test/test_dummy_thread.py @@ -31,7 +31,7 @@ class LockTests(unittest.TestCase): self.lock.release() self.failUnless(not self.lock.locked(), "Lock object did not release properly.") - + def test_improper_release(self): #Make sure release of an unlocked thread raises _thread.error self.failUnlessRaises(_thread.error, self.lock.release) @@ -58,7 +58,7 @@ class LockTests(unittest.TestCase): #Make sure that an unconditional locking returns True. self.failUnless(self.lock.acquire(1) is True, "Unconditional locking did not return True.") - + def test_uncond_acquire_blocking(self): #Make sure that unconditional acquiring of a locked lock blocks. def delay_unlock(to_unlock, delay): @@ -125,14 +125,14 @@ class ThreadTests(unittest.TestCase): self.failUnless(result[0] and result[1], "Argument passing for thread creation using both tuple" " and kwargs failed") - + def test_multi_creation(self): #Make sure multiple threads can be created. def queue_mark(queue, delay): """Wait for ``delay`` seconds and then put something into ``queue``""" time.sleep(delay) queue.put(_thread.get_ident()) - + thread_count = 5 delay = 1.5 testing_queue = Queue.Queue(thread_count) @@ -147,7 +147,7 @@ class ThreadTests(unittest.TestCase): if test_support.verbose: print 'done' self.failUnless(testing_queue.qsize() == thread_count, - "Not all %s threads executed properly after %s sec." % + "Not all %s threads executed properly after %s sec." % (thread_count, delay)) def test_main(imported_module=None): diff --git a/Lib/test/test_dummy_threading.py b/Lib/test/test_dummy_threading.py index cc8c0e3..e377230 100644 --- a/Lib/test/test_dummy_threading.py +++ b/Lib/test/test_dummy_threading.py @@ -9,7 +9,7 @@ import time class TestThread(_threading.Thread): - + def run(self): global running delay = random.random() * 2 @@ -54,7 +54,7 @@ def test_main(): global threads threads = [] - + starttasks() if verbose: diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py index d15bd28..87c66e9 100644 --- a/Lib/test/test_locale.py +++ b/Lib/test/test_locale.py @@ -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" diff --git a/Lib/test/test_macfs.py b/Lib/test/test_macfs.py index 64235ec..c9ca06b 100644 --- a/Lib/test/test_macfs.py +++ b/Lib/test/test_macfs.py @@ -22,11 +22,11 @@ class TestMacfs(unittest.TestCase): def test_fsspec(self): fss = macfs.FSSpec(test_support.TESTFN) self.assertEqual(os.path.realpath(test_support.TESTFN), fss.as_pathname()) - + def test_fsref(self): fsr = macfs.FSRef(test_support.TESTFN) self.assertEqual(os.path.realpath(test_support.TESTFN), fsr.as_pathname()) - + def test_coercion(self): fss = macfs.FSSpec(test_support.TESTFN) fsr = macfs.FSRef(test_support.TESTFN) @@ -34,7 +34,7 @@ class TestMacfs(unittest.TestCase): fsr2 = fss.as_fsref() self.assertEqual(fss.as_pathname(), fss2.as_pathname()) self.assertEqual(fsr.as_pathname(), fsr2.as_pathname()) - + def test_dates(self): import time fss = macfs.FSSpec(test_support.TESTFN) @@ -42,24 +42,24 @@ class TestMacfs(unittest.TestCase): fss.SetDates(now, now-1, now-2) dates = fss.GetDates() self.assertEqual(dates, (now, now-1, now-2)) - + def test_ctor_type(self): fss = macfs.FSSpec(test_support.TESTFN) fss.SetCreatorType('Pyth', 'TEXT') filecr, filetp = fss.GetCreatorType() self.assertEqual((filecr, filetp), ('Pyth', 'TEXT')) - + def test_alias(self): fss = macfs.FSSpec(test_support.TESTFN) alias = fss.NewAlias() fss2, changed = alias.Resolve() self.assertEqual(changed, 0) - self.assertEqual(fss.as_pathname(), fss2.as_pathname()) - - + self.assertEqual(fss.as_pathname(), fss2.as_pathname()) + + def test_fss_alias(self): fss = macfs.FSSpec(test_support.TESTFN) - + def test_main(): test_support.run_unittest(TestMacfs) diff --git a/Lib/test/test_macostools.py b/Lib/test/test_macostools.py index f5abb6d..d9578bb 100644 --- a/Lib/test/test_macostools.py +++ b/Lib/test/test_macostools.py @@ -29,7 +29,7 @@ class TestMacostools(unittest.TestCase): os.unlink(TESTFN2) except: pass - + def compareData(self): fp = open(test_support.TESTFN, 'r') data1 = fp.read() @@ -48,11 +48,11 @@ class TestMacostools(unittest.TestCase): if data1 != data2: return 'Resource forks differ' return '' - + def test_touched(self): # This really only tests that nothing unforeseen happens. macostools.touched(test_support.TESTFN) - + def test_copy(self): try: os.unlink(TESTFN2) @@ -60,7 +60,7 @@ class TestMacostools(unittest.TestCase): pass macostools.copy(test_support.TESTFN, TESTFN2) self.assertEqual(self.compareData(), '') - + def test_mkalias(self): try: os.unlink(TESTFN2) @@ -69,7 +69,7 @@ class TestMacostools(unittest.TestCase): macostools.mkalias(test_support.TESTFN, TESTFN2) fss, _, _ = macfs.ResolveAliasFile(TESTFN2) self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN)) - + def test_mkalias_relative(self): try: os.unlink(TESTFN2) @@ -78,8 +78,8 @@ class TestMacostools(unittest.TestCase): macostools.mkalias(test_support.TESTFN, TESTFN2, sys.prefix) fss, _, _ = macfs.ResolveAliasFile(TESTFN2) self.assertEqual(fss.as_pathname(), os.path.realpath(test_support.TESTFN)) - - + + def test_main(): test_support.run_unittest(TestMacostools) diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py index d78344e..ccdfd19 100644 --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -370,7 +370,7 @@ class IllegalSyntaxTestCase(unittest.TestCase): (266, (282, (1, 'foo'))), (4, ''))), (4, ''), - (0, '')) + (0, '')) self.check_bad_tree(tree, "malformed global ast") def test_main(): diff --git a/Lib/test/test_string.py b/Lib/test/test_string.py index e0f7990..97a7bdf 100644 --- a/Lib/test/test_string.py +++ b/Lib/test/test_string.py @@ -82,4 +82,3 @@ for prec in range(100): else: #print result pass - diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 606b8ce..b18b0c7 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -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"): diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index 4a8edb8..7b6d58d 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -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 diff --git a/Lib/test/test_userlist.py b/Lib/test/test_userlist.py index 12a4e59..aec4b80 100644 --- a/Lib/test/test_userlist.py +++ b/Lib/test/test_userlist.py @@ -258,4 +258,3 @@ def test_main(): if __name__ == "__main__": test_main() - diff --git a/Lib/test/test_xpickle.py b/Lib/test/test_xpickle.py index 0da6997..cc458ad 100644 --- a/Lib/test/test_xpickle.py +++ b/Lib/test/test_xpickle.py @@ -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__": diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py index c9aff4a..894b132 100644 --- a/Lib/test/test_zipimport.py +++ b/Lib/test/test_zipimport.py @@ -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 diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py index dc41e63..44a58cc 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -103,7 +103,7 @@ class CompressTestCase(unittest.TestCase): self.failUnless(last > len(data), "compress level 0 always expands") for level in range(10): length = len(zlib.compress(data, level)) - self.failUnless(length <= last, + self.failUnless(length <= last, 'compress level %d more effective than %d!' % ( level-1, level)) last = length @@ -506,4 +506,3 @@ if False: su = ut.TestSuite() su.addTest(ut.makeSuite(tz.CompressTestCase)) ts.run_suite(su) - diff --git a/Lib/test/tokenize_tests.py b/Lib/test/tokenize_tests.py index e990a36..4632ef1 100644 --- a/Lib/test/tokenize_tests.py +++ b/Lib/test/tokenize_tests.py @@ -1,5 +1,5 @@ # Tests for the 'tokenize' module. -# Large bits stolen from test_grammar.py. +# Large bits stolen from test_grammar.py. # Comments "#" @@ -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() - |