summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2013-02-09 12:53:29 -0500
committerR David Murray <rdmurray@bitdance.com>2013-02-09 12:53:29 -0500
commita5e7f8f8e043ff22889ad39c62130966706e36cb (patch)
treed6a3a795c5dfa621564d0033184e8004471015d9
parent56656b01182a2f480b333d9137908faff10b9ba5 (diff)
downloadcpython-git-a5e7f8f8e043ff22889ad39c62130966706e36cb.tar.gz
#16564: test to confirm behavior that regressed in python3.
Also add running of test_email_renamed to the email regrtest. It contains tests that the base email/tests/test_email.py does not, which I discovered while trying to backport this test for confirmation of the behavior.
-rw-r--r--Lib/email/test/test_email_renamed.py15
-rw-r--r--Lib/test/test_email.py2
-rw-r--r--Misc/NEWS4
3 files changed, 21 insertions, 0 deletions
diff --git a/Lib/email/test/test_email_renamed.py b/Lib/email/test/test_email_renamed.py
index 497b66b93e..4917d96104 100644
--- a/Lib/email/test/test_email_renamed.py
+++ b/Lib/email/test/test_email_renamed.py
@@ -994,6 +994,21 @@ class TestMIMEApplication(unittest.TestCase):
eq(msg.get_payload(), '+vv8/f7/')
eq(msg.get_payload(decode=True), bytes)
+ def test_body_with_encode_noop(self):
+ # Issue 16564: This does not produce an RFC valid message, since to be
+ # valid it should have a CTE of binary. But the below works, and is
+ # documented as working this way.
+ bytesdata = b'\xfa\xfb\xfc\xfd\xfe\xff'
+ msg = MIMEApplication(bytesdata, _encoder=encoders.encode_noop)
+ self.assertEqual(msg.get_payload(), bytesdata)
+ self.assertEqual(msg.get_payload(decode=True), bytesdata)
+ s = StringIO()
+ g = Generator(s)
+ g.flatten(msg)
+ wireform = s.getvalue()
+ msg2 = email.message_from_string(wireform)
+ self.assertEqual(msg.get_payload(), bytesdata)
+ self.assertEqual(msg2.get_payload(decode=True), bytesdata)
# Test the basic MIMEText class
diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py
index cb4ee6083e..ab6e0b0e25 100644
--- a/Lib/test/test_email.py
+++ b/Lib/test/test_email.py
@@ -3,10 +3,12 @@
# The specific tests now live in Lib/email/test
from email.test.test_email import suite
+from email.test.test_email_renamed import suite as suite2
from test import test_support
def test_main():
test_support.run_unittest(suite())
+ test_support.run_unittest(suite2())
if __name__ == '__main__':
test_main()
diff --git a/Misc/NEWS b/Misc/NEWS
index 00eb8ea6ff..92bd686ae8 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -748,6 +748,10 @@ Extension Modules
Tests
-----
+- We now run both test_email.py and test_email_renamed.py when running the
+ test_email regression test. test_email_renamed contains some tests that
+ test_email does not.
+
- Issue #17041: Fix testing when Python is configured with the
--without-doc-strings option.