diff options
author | Tim Peters <tim.peters@gmail.com> | 2007-01-30 03:03:46 +0000 |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2007-01-30 03:03:46 +0000 |
commit | f733abb7831d6566cb0fccd0550d58ec3b7f05a4 (patch) | |
tree | 4466e9eccc1b441e60841c16d48915f20216178e /Lib/test | |
parent | 15c1fe5047f94942f1e784ac7614f9f5370adb47 (diff) | |
download | cpython-git-f733abb7831d6566cb0fccd0550d58ec3b7f05a4.tar.gz |
Whitespace normalization.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_cfgparser.py | 6 | ||||
-rw-r--r-- | Lib/test/test_dumbdbm.py | 4 | ||||
-rw-r--r-- | Lib/test/test_gzip.py | 2 | ||||
-rw-r--r-- | Lib/test/test_mailbox.py | 8 | ||||
-rw-r--r-- | Lib/test/test_old_mailbox.py | 2 | ||||
-rw-r--r-- | Lib/test/test_pty.py | 6 | ||||
-rw-r--r-- | Lib/test/test_resource.py | 4 | ||||
-rw-r--r-- | Lib/test/test_set.py | 4 | ||||
-rw-r--r-- | Lib/test/test_struct.py | 98 | ||||
-rw-r--r-- | Lib/test/test_support.py | 2 |
10 files changed, 68 insertions, 68 deletions
diff --git a/Lib/test/test_cfgparser.py b/Lib/test/test_cfgparser.py index 3979f15455..9e3b495c5a 100644 --- a/Lib/test/test_cfgparser.py +++ b/Lib/test/test_cfgparser.py @@ -15,7 +15,7 @@ class SortedDict(UserDict.UserDict): result = self.data.keys() result.sort() return result - + def values(self): result = self.items() return [i[1] for i in values] @@ -446,12 +446,12 @@ class SortedTestCase(RawConfigParserTestCase): "o2=3\n" "o1=4\n" "[a]\n" - "k=v\n") + "k=v\n") output = StringIO.StringIO() self.cf.write(output) self.assertEquals(output.getvalue(), "[a]\n" - "k = v\n\n" + "k = v\n\n" "[b]\n" "o1 = 4\n" "o2 = 3\n" diff --git a/Lib/test/test_dumbdbm.py b/Lib/test/test_dumbdbm.py index 62fa3dd74e..041fac171f 100644 --- a/Lib/test/test_dumbdbm.py +++ b/Lib/test/test_dumbdbm.py @@ -49,7 +49,7 @@ class DumbDBMTestCase(unittest.TestCase): f.close() finally: os.umask(old_umask) - + expected_mode = 0635 if os.name != 'posix': # Windows only supports setting the read-only attribute. @@ -61,7 +61,7 @@ class DumbDBMTestCase(unittest.TestCase): self.assertEqual(stat.S_IMODE(st.st_mode), expected_mode) st = os.stat(_fname + '.dir') self.assertEqual(stat.S_IMODE(st.st_mode), expected_mode) - + def test_close_twice(self): f = dumbdbm.open(_fname) f['a'] = 'b' diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py index 9989a92b70..fbdbc304a1 100644 --- a/Lib/test/test_gzip.py +++ b/Lib/test/test_gzip.py @@ -138,7 +138,7 @@ class TestGzip(unittest.TestCase): y = f.read(10) f.close() self.assertEquals(y, data1[20:30]) - + def test_seek_write(self): # Try seek, write test f = gzip.GzipFile(self.filename, 'w') diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py index eb37d4a78d..8edb9ebd97 100644 --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -681,11 +681,11 @@ class TestMaildir(TestMailbox): box = self._factory(self._path, factory=dummy_factory) folder = box.add_folder('folder1') self.assert_(folder._factory is dummy_factory) - + folder1_alias = box.get_folder('folder1') self.assert_(folder1_alias._factory is dummy_factory) - + class _TestMboxMMDF(TestMailbox): @@ -805,7 +805,7 @@ class TestMH(TestMailbox): def dummy_factory (s): return None self._box = self._factory(self._path, dummy_factory) - + new_folder = self._box.add_folder('foo.bar') folder0 = self._box.get_folder('foo.bar') folder0.add(self._template % 'bar') @@ -901,7 +901,7 @@ class TestMH(TestMailbox): self.assert_(self._box.get_sequences() == {'foo':[1, 2, 3, 4, 5], 'unseen':[1], 'bar':[3], 'replied':[3]}) - + def _get_lock_path(self): return os.path.join(self._path, '.mh_sequences.lock') diff --git a/Lib/test/test_old_mailbox.py b/Lib/test/test_old_mailbox.py index c8f6bac64b..7bd555758a 100644 --- a/Lib/test/test_old_mailbox.py +++ b/Lib/test/test_old_mailbox.py @@ -116,7 +116,7 @@ class MboxTestCase(unittest.TestCase): def tearDown(self): os.unlink(self._path) - + def test_from_regex (self): # Testing new regex from bug #1633678 f = open(self._path, 'w') diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py index 8a83e39786..02290be71b 100644 --- a/Lib/test/test_pty.py +++ b/Lib/test/test_pty.py @@ -120,7 +120,7 @@ else: ##if False and lines != ['In child, calling os.setsid()', ## 'Good: OSError was raised.', '']: ## raise TestFailed("Unexpected output from child: %r" % line) - + (pid, status) = os.waitpid(pid, 0) res = status >> 8 debug("Child (%d) exited with status %d (%d)."%(pid, res, status)) @@ -140,8 +140,8 @@ else: ## pass ##else: ## raise TestFailed("Read from master_fd did not raise exception") - - + + os.close(master_fd) # pty.fork() passed. diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py index 5c9b929a9e..d1fd230ba8 100644 --- a/Lib/test/test_resource.py +++ b/Lib/test/test_resource.py @@ -15,7 +15,7 @@ class ResourceTest(unittest.TestCase): self.assertRaises(TypeError, resource.setrlimit, 42, 42, 42) def test_fsize_ismax(self): - + try: (cur, max) = resource.getrlimit(resource.RLIMIT_FSIZE) except AttributeError: @@ -39,7 +39,7 @@ class ResourceTest(unittest.TestCase): # versions of Python were terminated by an uncaught SIGXFSZ, but # pythonrun.c has been fixed to ignore that exception. If so, the # write() should return EFBIG when the limit is exceeded. - + # At least one platform has an unlimited RLIMIT_FSIZE and attempts # to change it raise ValueError instead. try: diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py index 49bdec3445..23b4f11a18 100644 --- a/Lib/test/test_set.py +++ b/Lib/test/test_set.py @@ -473,7 +473,7 @@ class SetSubclassWithKeywordArgs(set): set.__init__(self, iterable) class TestSetSubclassWithKeywordArgs(TestSet): - + def test_keywords_in_subclass(self): 'SF bug #1486663 -- this used to erroneously raise a TypeError' SetSubclassWithKeywordArgs(newarg=1) @@ -1460,7 +1460,7 @@ def test_main(verbose=None): test_classes = ( TestSet, TestSetSubclass, - TestSetSubclassWithKeywordArgs, + TestSetSubclassWithKeywordArgs, TestFrozenSet, TestFrozenSetSubclass, TestSetOfSets, diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py index b6a3e0bf97..f5019bf192 100644 --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -119,7 +119,7 @@ for prefix in ('', '@', '<', '>', '=', '!'): cp, bp, hp, ip, lp, fp, dp, tp = struct.unpack(format, s) if (cp != c or bp != b or hp != h or ip != i or lp != l or int(100 * fp) != int(100 * f) or int(100 * dp) != int(100 * d) or - tp != t): + tp != t): # ^^^ calculate only to two decimal places raise TestFailed, "unpack/pack not transitive (%s, %s)" % ( str(format), str((cp, bp, hp, ip, lp, fp, dp, tp))) @@ -160,11 +160,11 @@ tests = [ ('f', -2.0, '\300\000\000\000', '\000\000\000\300', 0), ('d', -2.0, '\300\000\000\000\000\000\000\000', '\000\000\000\000\000\000\000\300', 0), - ('t', 0, '\0', '\0', 0), - ('t', 3, '\1', '\1', 1), - ('t', True, '\1', '\1', 0), - ('t', [], '\0', '\0', 1), - ('t', (1,), '\1', '\1', 1), + ('t', 0, '\0', '\0', 0), + ('t', 3, '\1', '\1', 1), + ('t', True, '\1', '\1', 0), + ('t', [], '\0', '\0', 1), + ('t', (1,), '\1', '\1', 1), ] for fmt, arg, big, lil, asy in tests: @@ -621,48 +621,48 @@ test_pack_into() test_pack_into_fn() def test_bool(): - for prefix in tuple("<>!=")+('',): - false = (), [], [], '', 0 - true = [1], 'test', 5, -1, 0xffffffffL+1, 0xffffffff/2 - - falseFormat = prefix + 't' * len(false) - if verbose: - print 'trying bool pack/unpack on', false, 'using format', falseFormat - packedFalse = struct.pack(falseFormat, *false) - unpackedFalse = struct.unpack(falseFormat, packedFalse) - - trueFormat = prefix + 't' * len(true) - if verbose: - print 'trying bool pack/unpack on', true, 'using format', trueFormat - packedTrue = struct.pack(trueFormat, *true) - unpackedTrue = struct.unpack(trueFormat, packedTrue) - - if len(true) != len(unpackedTrue): - raise TestFailed('unpacked true array is not of same size as input') - if len(false) != len(unpackedFalse): - raise TestFailed('unpacked false array is not of same size as input') - - for t in unpackedFalse: - if t is not False: - raise TestFailed('%r did not unpack as False' % t) - for t in unpackedTrue: - if t is not True: - raise TestFailed('%r did not unpack as false' % t) - - if prefix and verbose: - print 'trying size of bool with format %r' % (prefix+'t') - packed = struct.pack(prefix+'t', 1) - - if len(packed) != struct.calcsize(prefix+'t'): - raise TestFailed('packed length is not equal to calculated size') - - if len(packed) != 1 and prefix: - raise TestFailed('encoded bool is not one byte: %r' % packed) - elif not prefix and verbose: - print 'size of bool in native format is %i' % (len(packed)) - - for c in '\x01\x7f\xff\x0f\xf0': - if struct.unpack('>t', c)[0] is not True: - raise TestFailed('%c did not unpack as True' % c) + for prefix in tuple("<>!=")+('',): + false = (), [], [], '', 0 + true = [1], 'test', 5, -1, 0xffffffffL+1, 0xffffffff/2 + + falseFormat = prefix + 't' * len(false) + if verbose: + print 'trying bool pack/unpack on', false, 'using format', falseFormat + packedFalse = struct.pack(falseFormat, *false) + unpackedFalse = struct.unpack(falseFormat, packedFalse) + + trueFormat = prefix + 't' * len(true) + if verbose: + print 'trying bool pack/unpack on', true, 'using format', trueFormat + packedTrue = struct.pack(trueFormat, *true) + unpackedTrue = struct.unpack(trueFormat, packedTrue) + + if len(true) != len(unpackedTrue): + raise TestFailed('unpacked true array is not of same size as input') + if len(false) != len(unpackedFalse): + raise TestFailed('unpacked false array is not of same size as input') + + for t in unpackedFalse: + if t is not False: + raise TestFailed('%r did not unpack as False' % t) + for t in unpackedTrue: + if t is not True: + raise TestFailed('%r did not unpack as false' % t) + + if prefix and verbose: + print 'trying size of bool with format %r' % (prefix+'t') + packed = struct.pack(prefix+'t', 1) + + if len(packed) != struct.calcsize(prefix+'t'): + raise TestFailed('packed length is not equal to calculated size') + + if len(packed) != 1 and prefix: + raise TestFailed('encoded bool is not one byte: %r' % packed) + elif not prefix and verbose: + print 'size of bool in native format is %i' % (len(packed)) + + for c in '\x01\x7f\xff\x0f\xf0': + if struct.unpack('>t', c)[0] is not True: + raise TestFailed('%c did not unpack as True' % c) test_bool() diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index fa02eac613..82fd5f4131 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -270,7 +270,7 @@ def open_urlresource(url): print >> get_original_stdout(), '\tfetching %s ...' % url fn, _ = urllib.urlretrieve(url, filename) return open(fn) - + @contextmanager def guard_warnings_filter(): """Guard the warnings filter from being permanently changed.""" |