[Python-checkins] CVS: python/dist/src/Lib/test test_email.py,1.10,1.11

Barry Warsaw bwarsaw@users.sourceforge.net
Wed, 17 Oct 2001 13:52:29 -0700


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

Modified Files:
	test_email.py 
Log Message:
Two merges from the mimelib project:

    test_no_semis_header_splitter(): This actually should still split.

    test_no_split_long_header(): An example of an unsplittable line.

    test_no_semis_header_splitter(): Test for SF bug # 471918, Generator
    splitting long headers.


Index: test_email.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_email.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** test_email.py	2001/10/15 04:39:02	1.10
--- test_email.py	2001/10/17 20:52:26	1.11
***************
*** 29,32 ****
--- 29,33 ----
  NL = '\n'
  EMPTYSTRING = ''
+ SPACE = ' '
  
  
***************
*** 276,279 ****
--- 277,313 ----
          g(msg)
          self.assertEqual(sfp.getvalue(), openfile('msg_18.txt').read())
+ 
+     def test_no_semis_header_splitter(self):
+         msg = Message()
+         msg['From'] = 'test@dom.ain'
+         refparts = []
+         for i in range(10):
+             refparts.append('<%d@dom.ain>' % i)
+         msg['References'] = SPACE.join(refparts)
+         msg.set_payload('Test')
+         sfp = StringIO()
+         g = Generator(sfp)
+         g(msg)
+         self.assertEqual(sfp.getvalue(), """\
+ From: test@dom.ain
+ References: <0@dom.ain> <1@dom.ain> <2@dom.ain> <3@dom.ain> <4@dom.ain>
+ 	<5@dom.ain> <6@dom.ain> <7@dom.ain> <8@dom.ain> <9@dom.ain>
+ 
+ Test""")
+ 
+     def test_no_split_long_header(self):
+         msg = Message()
+         msg['From'] = 'test@dom.ain'
+         refparts = []
+         msg['References'] = 'x' * 80
+         msg.set_payload('Test')
+         sfp = StringIO()
+         g = Generator(sfp)
+         g(msg)
+         self.assertEqual(sfp.getvalue(), """\
+ From: test@dom.ain
+ References: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+ 
+ Test""")