[Python-checkins] r86567 - python/branches/py3k/Lib/email/test/test_email.py
r.david.murray
python-checkins at python.org
Sat Nov 20 16:10:14 CET 2010
Author: r.david.murray
Date: Sat Nov 20 16:10:13 2010
New Revision: 86567
Log:
Improve TestBytesGeneratorIdempotent using by using linesep.
Also corrects a typo from a previous commit. Unfortunately
this does *not* fix issue #10134.
Modified:
python/branches/py3k/Lib/email/test/test_email.py
Modified: python/branches/py3k/Lib/email/test/test_email.py
==============================================================================
--- python/branches/py3k/Lib/email/test/test_email.py (original)
+++ python/branches/py3k/Lib/email/test/test_email.py Sat Nov 20 16:10:13 2010
@@ -77,7 +77,7 @@
eq(msg.get_all('cc'), ['ccc at zzz.org', 'ddd at zzz.org', 'eee at zzz.org'])
eq(msg.get_all('xx', 'n/a'), 'n/a')
- def TEst_getset_charset(self):
+ def test_getset_charset(self):
eq = self.assertEqual
msg = Message()
eq(msg.get_charset(), None)
@@ -2957,6 +2957,8 @@
class TestBytesGeneratorIdempotent(TestIdempotent):
+ maxDiff = None
+
def _msgobj(self, filename):
with openfile(filename, 'rb') as fp:
data = fp.read()
@@ -2964,14 +2966,14 @@
return msg, data
def _idempotent(self, msg, data):
+ # 13 = b'\r'
+ linesep = '\r\n' if data[data.index(b'\n')-1] == 13 else '\n'
b = BytesIO()
g = email.generator.BytesGenerator(b, maxheaderlen=0)
- g.flatten(msg)
- self.assertEqual(data, b.getvalue())
-
- maxDiff = None
+ g.flatten(msg, linesep=linesep)
+ self.assertByteStringsEqual(data, b.getvalue())
- def assertEqual(self, str1, str2):
+ def assertByteStringsEqual(self, str1, str2):
self.assertListEqual(str1.split(b'\n'), str2.split(b'\n'))
More information about the Python-checkins
mailing list