summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_email.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2001-10-15 04:39:02 (GMT)
committerBarry Warsaw <barry@python.org>2001-10-15 04:39:02 (GMT)
commitcdc632cfdbb6b5cebc6a39ec2d65905e304280fa (patch)
tree007331ca7bdb4bc6df89820533a7eecb63bf3bf4 /Lib/test/test_email.py
parent0164b6bf227ca920af52608784f5c5605b6d3283 (diff)
downloadcpython-cdc632cfdbb6b5cebc6a39ec2d65905e304280fa.zip
cpython-cdc632cfdbb6b5cebc6a39ec2d65905e304280fa.tar.gz
cpython-cdc632cfdbb6b5cebc6a39ec2d65905e304280fa.tar.bz2
test_typed_subpart_iterator_default_type(): Test for when the message
has no Content-Type: header, it should be treated as text/plain.
Diffstat (limited to 'Lib/test/test_email.py')
-rw-r--r--Lib/test/test_email.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py
index 3134a88..fe6ffd2 100644
--- a/Lib/test/test_email.py
+++ b/Lib/test/test_email.py
@@ -886,6 +886,24 @@ a simple kind of mirror
to reflect upon our own
""")
+ def test_typed_subpart_iterator_default_type(self):
+ eq = self.assertEqual
+ msg = self._msgobj('msg_03.txt')
+ it = Iterators.typed_subpart_iterator(msg, 'text', 'plain')
+ lines = []
+ subparts = 0
+ for subpart in it:
+ subparts += 1
+ lines.append(subpart.get_payload())
+ eq(subparts, 1)
+ eq(EMPTYSTRING.join(lines), """\
+
+Hi,
+
+Do you like this message?
+
+-Me
+""")
class TestParsers(unittest.TestCase):