Kaydet (Commit) 87cc0c32 authored tarafından Tim Peters's avatar Tim Peters

Whitespace normalization, plus:

+ test_quopri.py relied on significant trailing spaces.  Fixed.
+ test_dircache.py (still) doesn't work on Windows (directory mtime on
  Windows doesn't work like it does on Unix).
üst 3332778f
...@@ -566,10 +566,10 @@ class IMAP4: ...@@ -566,10 +566,10 @@ class IMAP4:
(typ, [data]) = <instance>.sort(sort_criteria, charset, search_criteria, ...) (typ, [data]) = <instance>.sort(sort_criteria, charset, search_criteria, ...)
""" """
name = 'SORT' name = 'SORT'
#if not name in self.capabilities: # Let the server decide! #if not name in self.capabilities: # Let the server decide!
# raise self.error('unimplemented extension command: %s' % name) # raise self.error('unimplemented extension command: %s' % name)
if (sort_criteria[0],sort_criteria[-1]) != ('(',')'): if (sort_criteria[0],sort_criteria[-1]) != ('(',')'):
sort_criteria = '(%s)' % sort_criteria sort_criteria = '(%s)' % sort_criteria
typ, dat = apply(self._simple_command, (name, sort_criteria, charset) + search_criteria) typ, dat = apply(self._simple_command, (name, sort_criteria, charset) + search_criteria)
return self._untagged_response(typ, dat, name) return self._untagged_response(typ, dat, name)
...@@ -580,7 +580,7 @@ class IMAP4: ...@@ -580,7 +580,7 @@ class IMAP4:
(typ, [data]) = <instance>.status(mailbox, names) (typ, [data]) = <instance>.status(mailbox, names)
""" """
name = 'STATUS' name = 'STATUS'
#if self.PROTOCOL_VERSION == 'IMAP4': # Let the server decide! #if self.PROTOCOL_VERSION == 'IMAP4': # Let the server decide!
# raise self.error('%s unimplemented in IMAP4 (obtain IMAP4rev1 server, or re-code)' % name) # raise self.error('%s unimplemented in IMAP4 (obtain IMAP4rev1 server, or re-code)' % name)
typ, dat = self._simple_command(name, mailbox, names) typ, dat = self._simple_command(name, mailbox, names)
return self._untagged_response(typ, dat, name) return self._untagged_response(typ, dat, name)
...@@ -647,7 +647,7 @@ class IMAP4: ...@@ -647,7 +647,7 @@ class IMAP4:
Returns response appropriate to extension command `name'. Returns response appropriate to extension command `name'.
""" """
name = name.upper() name = name.upper()
#if not name in self.capabilities: # Let the server decide! #if not name in self.capabilities: # Let the server decide!
# raise self.error('unknown extension command: %s' % name) # raise self.error('unknown extension command: %s' % name)
if not Commands.has_key(name): if not Commands.has_key(name):
Commands[name] = (self.state,) Commands[name] = (self.state,)
......
...@@ -286,7 +286,7 @@ def _optimize_unicode(charset, fixup): ...@@ -286,7 +286,7 @@ def _optimize_unicode(charset, fixup):
else: else:
header.append(mapping[2*i]+256*mapping[2*i+1]) header.append(mapping[2*i]+256*mapping[2*i+1])
data[0:0] = header data[0:0] = header
return [(BIGCHARSET, data)] return [(BIGCHARSET, data)]
def _simple(av): def _simple(av):
# check if av is a "simple" operator # check if av is a "simple" operator
......
...@@ -31,15 +31,15 @@ class DircacheTests(unittest.TestCase): ...@@ -31,15 +31,15 @@ class DircacheTests(unittest.TestCase):
os.rmdir(fname) os.rmdir(fname)
else: else:
os.unlink(fname) os.unlink(fname)
def test_listdir(self): def test_listdir(self):
## SUCCESSFUL CASES ## SUCCESSFUL CASES
entries = dircache.listdir(self.tempdir) entries = dircache.listdir(self.tempdir)
self.assertEquals(entries, []) self.assertEquals(entries, [])
# Check that cache is actually caching, not just passing through. # Check that cache is actually caching, not just passing through.
self.assert_(dircache.listdir(self.tempdir) is entries) self.assert_(dircache.listdir(self.tempdir) is entries)
# Sadly, dircache has the same granularity as stat.mtime, and so # Sadly, dircache has the same granularity as stat.mtime, and so
# can't notice any changes that occured within 1 sec of the last # can't notice any changes that occured within 1 sec of the last
# time it examined a directory. # time it examined a directory.
...@@ -48,7 +48,7 @@ class DircacheTests(unittest.TestCase): ...@@ -48,7 +48,7 @@ class DircacheTests(unittest.TestCase):
entries = dircache.listdir(self.tempdir) entries = dircache.listdir(self.tempdir)
self.assertEquals(entries, ['test1']) self.assertEquals(entries, ['test1'])
self.assert_(dircache.listdir(self.tempdir) is entries) self.assert_(dircache.listdir(self.tempdir) is entries)
## UNSUCCESSFUL CASES ## UNSUCCESSFUL CASES
self.assertEquals(dircache.listdir(self.tempdir+"_nonexistent"), []) self.assertEquals(dircache.listdir(self.tempdir+"_nonexistent"), [])
......
...@@ -52,7 +52,7 @@ class TemporaryFileTests(unittest.TestCase): ...@@ -52,7 +52,7 @@ class TemporaryFileTests(unittest.TestCase):
if not hasattr(os, "tmpnam"): if not hasattr(os, "tmpnam"):
return return
self.check_tempfile(os.tmpnam()) self.check_tempfile(os.tmpnam())
run_unittest(TemporaryFileTests) run_unittest(TemporaryFileTests)
...@@ -5,7 +5,7 @@ from cStringIO import StringIO ...@@ -5,7 +5,7 @@ from cStringIO import StringIO
from quopri import * from quopri import *
ENCSAMPLE = """\ ENCSAMPLE = """\
Here's a bunch of special=20 Here's a bunch of special=20
...@@ -25,8 +25,8 @@ characters... have fun! ...@@ -25,8 +25,8 @@ characters... have fun!
""" """
# First line ends with a space # First line ends with a space
DECSAMPLE = """\ DECSAMPLE = "Here's a bunch of special \n" + \
Here's a bunch of special """\
...@@ -44,7 +44,7 @@ characters... have fun! ...@@ -44,7 +44,7 @@ characters... have fun!
""" """
class QuopriTestCase(unittest.TestCase): class QuopriTestCase(unittest.TestCase):
# Each entry is a tuple of (plaintext, encoded string). These strings are # Each entry is a tuple of (plaintext, encoded string). These strings are
# used in the "quotetabs=0" tests. # used in the "quotetabs=0" tests.
...@@ -103,15 +103,15 @@ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz''') ...@@ -103,15 +103,15 @@ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz''')
('hello world', 'hello=20world'), ('hello world', 'hello=20world'),
('hello\tworld', 'hello=09world'), ('hello\tworld', 'hello=09world'),
) )
def test_encodestring(self): def test_encodestring(self):
for p, e in self.STRINGS: for p, e in self.STRINGS:
self.assert_(encodestring(p) == e) self.assert_(encodestring(p) == e)
def test_decodestring(self): def test_decodestring(self):
for p, e in self.STRINGS: for p, e in self.STRINGS:
self.assert_(decodestring(e) == p) self.assert_(decodestring(e) == p)
def test_idempotent_string(self): def test_idempotent_string(self):
for p, e in self.STRINGS: for p, e in self.STRINGS:
self.assert_(decodestring(encodestring(e)) == e) self.assert_(decodestring(encodestring(e)) == e)
...@@ -135,5 +135,5 @@ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz''') ...@@ -135,5 +135,5 @@ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz''')
self.assert_(encodestring(p, quotetabs=1) == e) self.assert_(encodestring(p, quotetabs=1) == e)
self.assert_(decodestring(e) == p) self.assert_(decodestring(e) == p)
test_support.run_unittest(QuopriTestCase) test_support.run_unittest(QuopriTestCase)
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