[Python-checkins] python/dist/src/Lib/test test_email.py,1.31,1.32

bwarsaw@sourceforge.net bwarsaw@sourceforge.net
Sun, 19 May 2002 16:52:56 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv27939/Lib/test

Modified Files:
	test_email.py 
Log Message:
Add two new tests of recent email package fixes: CRLF line endings,
and explicit maxlinelen arguments to the Header constructor.


Index: test_email.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_email.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** test_email.py	23 Apr 2002 10:52:44 -0000	1.31
--- test_email.py	19 May 2002 23:52:54 -0000	1.32
***************
*** 1324,1327 ****
--- 1324,1339 ----
          eq(msg.get_payload(), "Here's the message body\n")
  
+     def test_crlf_separation(self):
+         eq = self.assertEqual
+         fp = openfile('msg_26.txt')
+         p = Parser()
+         msg = p.parse(fp)
+         eq(len(msg.get_payload()), 2)
+         part1 = msg.get_payload(0)
+         eq(part1.get_type(), 'text/plain')
+         eq(part1.get_payload(), 'Simple email with attachment.\r\n\r\n')
+         part2 = msg.get_payload(1)
+         eq(part2.get_type(), 'application/riscos')
+ 
  
  
***************
*** 1573,1576 ****
--- 1585,1602 ----
             [(g_head, "iso-8859-1"), (cz_head, "iso-8859-2"),
              (utf8_head, "utf-8")])
+ 
+     def test_explicit_maxlinelen(self):
+         eq = self.assertEqual
+         hstr = 'A very long line that must get split to something other than at the 76th character boundary to test the non-default behavior'
+         h = Header(hstr)
+         eq(h.encode(), '''\
+ A very long line that must get split to something other than at the 76th cha
+  racter boundary to test the non-default behavior''')
+         h = Header(hstr, header_name='Subject')
+         eq(h.encode(), '''\
+ A very long line that must get split to something other than at the
+   76th character boundary to test the non-default behavior''')
+         h = Header(hstr, maxlinelen=1024, header_name='Subject')
+         eq(h.encode(), hstr)