diff options
author | Petri Lehtinen <petri@digip.org> | 2012-08-15 11:36:14 (GMT) |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2012-08-15 11:36:14 (GMT) |
commit | aae61b8cd02479180d326889c717daa413029b4d (patch) | |
tree | d18aa2fc04b4cf30134c0d2a733d47cfd8e3c05e /Lib | |
parent | 3115f0d14b5a8b65be57f21c0866586bd4e06fa2 (diff) | |
parent | 3d12c4317c2970d65bf30e941070017a8d1be210 (diff) | |
download | cpython-aae61b8cd02479180d326889c717daa413029b4d.zip cpython-aae61b8cd02479180d326889c717daa413029b4d.tar.gz cpython-aae61b8cd02479180d326889c717daa413029b4d.tar.bz2 |
#11062: Fix adding a message from file to Babyl mailbox
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/mailbox.py | 2 | ||||
-rw-r--r-- | Lib/test/test_mailbox.py | 18 |
2 files changed, 7 insertions, 13 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py index 3ab3396..30877f1 100644 --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -1440,9 +1440,9 @@ class Babyl(_singlefileMailbox): line = line[:-1] + b'\n' self._file.write(line.replace(b'\n', linesep)) if line == b'\n' or not line: - self._file.write(b'*** EOOH ***' + linesep) if first_pass: first_pass = False + self._file.write(b'*** EOOH ***' + linesep) message.seek(original_pos) else: break diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py index 52d2cd6..5515357 100644 --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -152,20 +152,16 @@ class TestMailbox(TestBase): f.write(_bytes_sample_message) f.seek(0) key = self._box.add(f) - # See issue 11062 - if not isinstance(self._box, mailbox.Babyl): - self.assertEqual(self._box.get_bytes(key).split(b'\n'), - _bytes_sample_message.split(b'\n')) + self.assertEqual(self._box.get_bytes(key).split(b'\n'), + _bytes_sample_message.split(b'\n')) def test_add_binary_nonascii_file(self): with tempfile.TemporaryFile('wb+') as f: f.write(self._non_latin_bin_msg) f.seek(0) key = self._box.add(f) - # See issue 11062 - if not isinstance(self._box, mailbox.Babyl): - self.assertEqual(self._box.get_bytes(key).split(b'\n'), - self._non_latin_bin_msg.split(b'\n')) + self.assertEqual(self._box.get_bytes(key).split(b'\n'), + self._non_latin_bin_msg.split(b'\n')) def test_add_text_file_warns(self): with tempfile.TemporaryFile('w+') as f: @@ -173,10 +169,8 @@ class TestMailbox(TestBase): f.seek(0) with self.assertWarns(DeprecationWarning): key = self._box.add(f) - # See issue 11062 - if not isinstance(self._box, mailbox.Babyl): - self.assertEqual(self._box.get_bytes(key).split(b'\n'), - _bytes_sample_message.split(b'\n')) + self.assertEqual(self._box.get_bytes(key).split(b'\n'), + _bytes_sample_message.split(b'\n')) def test_add_StringIO_warns(self): with self.assertWarns(DeprecationWarning): |