]> granicus.if.org Git - python/commitdiff
test_typed_subpart_iterator_default_type(): Test for when the message
authorBarry Warsaw <barry@python.org>
Mon, 15 Oct 2001 04:39:02 +0000 (04:39 +0000)
committerBarry Warsaw <barry@python.org>
Mon, 15 Oct 2001 04:39:02 +0000 (04:39 +0000)
has no Content-Type: header, it should be treated as text/plain.

Lib/test/test_email.py

index 3134a88e013b36c28411626433ee3dba4d416663..fe6ffd2a1972c59b5256714a9f372269914ab885 100644 (file)
@@ -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
+""")
 
 \f
 class TestParsers(unittest.TestCase):