diff options
author | R. David Murray <rdmurray@bitdance.com> | 2010-11-20 15:10:13 (GMT) |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2010-11-20 15:10:13 (GMT) |
commit | e5db2636f3fedd772e55ce55e4cf820475f29fe3 (patch) | |
tree | 13aec71de3e8a70c1ea83a3567ea7c8fce1f2207 /Lib/email/test | |
parent | 95fc51dfda805c2c1aa7aacf9a100d90c8747ffc (diff) | |
download | cpython-e5db2636f3fedd772e55ce55e4cf820475f29fe3.zip cpython-e5db2636f3fedd772e55ce55e4cf820475f29fe3.tar.gz cpython-e5db2636f3fedd772e55ce55e4cf820475f29fe3.tar.bz2 |
Improve TestBytesGeneratorIdempotent using by using linesep.
Also corrects a typo from a previous commit. Unfortunately
this does *not* fix issue #10134.
Diffstat (limited to 'Lib/email/test')
-rw-r--r-- | Lib/email/test/test_email.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py index 34af777..89effcb 100644 --- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -77,7 +77,7 @@ class TestMessageAPI(TestEmailBase): eq(msg.get_all('cc'), ['ccc@zzz.org', 'ddd@zzz.org', 'eee@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 Test8BitBytesHandling(unittest.TestCase): class TestBytesGeneratorIdempotent(TestIdempotent): + maxDiff = None + def _msgobj(self, filename): with openfile(filename, 'rb') as fp: data = fp.read() @@ -2964,14 +2966,14 @@ class TestBytesGeneratorIdempotent(TestIdempotent): 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')) |