comparison test/test_mailsplit.py @ 704:54333751e98d search_indexing-0-4-2-branch

Brought search_indexing-branch up to date with latest changes in HEAD.
author Roche Compaan <rochecompaan@users.sourceforge.net>
date Thu, 02 May 2002 13:09:11 +0000
parents 3f6107488465
children
comparison
equal deleted inserted replaced
703:8d2cb0d09da4 704:54333751e98d
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 # 17 #
18 # $Id: test_mailsplit.py,v 1.9 2002-01-10 06:19:20 richard Exp $ 18 # $Id: test_mailsplit.py,v 1.9.2.1 2002-05-02 13:09:11 rochecompaan Exp $
19 19
20 import unittest, cStringIO 20 import unittest, cStringIO
21 21
22 from roundup.mailgw import parseContent 22 from roundup.mailgw import parseContent
23 23
42 42
43 -- 43 --
44 blah blah blah signature 44 blah blah blah signature
45 userfoo@foo.com 45 userfoo@foo.com
46 ''' 46 '''
47 summary, content = parseContent(s) 47 summary, content = parseContent(s, 0, 0)
48 self.assertEqual(summary, 'blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah') 48 self.assertEqual(summary, 'blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah')
49 self.assertEqual(content, 'blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah\nblah blah blah blah blah blah blah blah blah blah blah!') 49 self.assertEqual(content, 'blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah\nblah blah blah blah blah blah blah blah blah blah blah!')
50
50 51
51 def testPostComment(self): 52 def testPostComment(self):
52 s = ''' 53 s = '''
53 issue_tracker@foo.com wrote: 54 issue_tracker@foo.com wrote:
54 > blah blah blah blahblah blahblah blahblah blah blah blah blah blah 55 > blah blah blah blahblah blahblah blahblah blah blah blah blah blah
71 72
72 -- 73 --
73 blah blah blah signature 74 blah blah blah signature
74 userfoo@foo.com 75 userfoo@foo.com
75 ''' 76 '''
76 summary, content = parseContent(s) 77 summary, content = parseContent(s, 0, 0)
77 self.assertEqual(summary, 'blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah') 78 self.assertEqual(summary, 'blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah')
78 self.assertEqual(content, 'blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah\nblah blah blah blah blah blah blah blah blah blah blah!') 79 self.assertEqual(content, 'blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah\nblah blah blah blah blah blah blah blah blah blah blah!')
80
81
82 def testKeepCitation(self):
83 s = '''
84 blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah
85 blah blah blah blah blah blah blah blah blah blah blah!
86
87 issue_tracker@foo.com wrote:
88 > blah blah blah blahblah blahblah blahblah blah blah blah blah blah blah
89 > blah blah blah blah blah blah blah blah blah? blah blah blah blah blah
90 > blah blah blah blah blah blah blah... blah blah blah blah. blah blah
91 > blah blah blah blah? blah blah blah blah blah blah! blah blah!
92 >
93 > -------
94 > nosy: userfoo, userken
95 > _________________________________________________
96 > Roundup issue tracker
97 > issue_tracker@foo.com
98 > http://foo.com/cgi-bin/roundup.cgi/issue_tracker/
99
100 --
101 blah blah blah signature
102 userfoo@foo.com
103 '''
104 summary, content = parseContent(s, 1, 0)
105 self.assertEqual(summary, 'blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah')
106 self.assertEqual(content, '''\
107 blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah
108 blah blah blah blah blah blah blah blah blah blah blah!
109
110 issue_tracker@foo.com wrote:
111 > blah blah blah blahblah blahblah blahblah blah blah blah blah blah blah
112 > blah blah blah blah blah blah blah blah blah? blah blah blah blah blah
113 > blah blah blah blah blah blah blah... blah blah blah blah. blah blah
114 > blah blah blah blah? blah blah blah blah blah blah! blah blah!
115 >
116 > -------
117 > nosy: userfoo, userken
118 > _________________________________________________
119 > Roundup issue tracker
120 > issue_tracker@foo.com
121 > http://foo.com/cgi-bin/roundup.cgi/issue_tracker/''')
122
123
124 def testKeepBody(self):
125 s = '''
126 blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah
127 blah blah blah blah blah blah blah blah blah blah blah!
128
129 issue_tracker@foo.com wrote:
130 > blah blah blah blahblah blahblah blahblah blah blah blah blah blah blah
131 > blah blah blah blah blah blah blah blah blah? blah blah blah blah blah
132 > blah blah blah blah blah blah blah... blah blah blah blah. blah blah
133 > blah blah blah blah? blah blah blah blah blah blah! blah blah!
134 >
135 > -------
136 > nosy: userfoo, userken
137 > _________________________________________________
138 > Roundup issue tracker
139 > issue_tracker@foo.com
140 > http://foo.com/cgi-bin/roundup.cgi/issue_tracker/
141
142 --
143 blah blah blah signature
144 userfoo@foo.com
145 '''
146 summary, content = parseContent(s, 0, 1)
147 self.assertEqual(summary, 'blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah')
148 self.assertEqual(content, '''
149 blah blah blah blah... blah blah? blah blah blah blah blah. blah blah blah
150 blah blah blah blah blah blah blah blah blah blah blah!
151
152 issue_tracker@foo.com wrote:
153 > blah blah blah blahblah blahblah blahblah blah blah blah blah blah blah
154 > blah blah blah blah blah blah blah blah blah? blah blah blah blah blah
155 > blah blah blah blah blah blah blah... blah blah blah blah. blah blah
156 > blah blah blah blah? blah blah blah blah blah blah! blah blah!
157 >
158 > -------
159 > nosy: userfoo, userken
160 > _________________________________________________
161 > Roundup issue tracker
162 > issue_tracker@foo.com
163 > http://foo.com/cgi-bin/roundup.cgi/issue_tracker/
164
165 --
166 blah blah blah signature
167 userfoo@foo.com
168 ''')
169
79 170
80 def testSimple(self): 171 def testSimple(self):
81 s = '''testing''' 172 s = '''testing'''
82 summary, content = parseContent(s) 173 summary, content = parseContent(s, 0, 0)
83 self.assertEqual(summary, 'testing') 174 self.assertEqual(summary, 'testing')
84 self.assertEqual(content, 'testing') 175 self.assertEqual(content, 'testing')
85 176
86 def testParagraphs(self): 177 def testParagraphs(self):
87 s = '''testing\n\ntesting\n\ntesting''' 178 s = '''testing\n\ntesting\n\ntesting'''
88 summary, content = parseContent(s) 179 summary, content = parseContent(s, 0, 0)
89 self.assertEqual(summary, 'testing') 180 self.assertEqual(summary, 'testing')
90 self.assertEqual(content, 'testing\n\ntesting\n\ntesting') 181 self.assertEqual(content, 'testing\n\ntesting\n\ntesting')
91 182
92 def testSimpleFollowup(self): 183 def testSimpleFollowup(self):
93 s = '''>hello\ntesting''' 184 s = '''>hello\ntesting'''
94 summary, content = parseContent(s) 185 summary, content = parseContent(s, 0, 0)
95 self.assertEqual(summary, 'testing') 186 self.assertEqual(summary, 'testing')
96 self.assertEqual(content, 'testing') 187 self.assertEqual(content, 'testing')
97 188
98 def testSimpleFollowupParas(self): 189 def testSimpleFollowupParas(self):
99 s = '''>hello\ntesting\n\ntesting\n\ntesting''' 190 s = '''>hello\ntesting\n\ntesting\n\ntesting'''
100 summary, content = parseContent(s) 191 summary, content = parseContent(s, 0, 0)
101 self.assertEqual(summary, 'testing') 192 self.assertEqual(summary, 'testing')
102 self.assertEqual(content, 'testing\n\ntesting\n\ntesting') 193 self.assertEqual(content, 'testing\n\ntesting\n\ntesting')
103 194
104 def testEmpty(self): 195 def testEmpty(self):
105 s = '' 196 s = ''
106 summary, content = parseContent(s) 197 summary, content = parseContent(s, 0, 0)
107 self.assertEqual(summary, '') 198 self.assertEqual(summary, '')
108 self.assertEqual(content, '') 199 self.assertEqual(content, '')
109 200
110 def testIndentationSummary(self): 201 def testIndentationSummary(self):
111 s = ' Four space indent.\n\n Four space indent.\nNo indent.' 202 s = ' Four space indent.\n\n Four space indent.\nNo indent.'
112 summary, content = parseContent(s) 203 summary, content = parseContent(s, 0, 0)
113 self.assertEqual(summary, ' Four space indent.') 204 self.assertEqual(summary, ' Four space indent.')
114 205
115 def testIndentationContent(self): 206 def testIndentationContent(self):
116 s = ' Four space indent.\n\n Four space indent.\nNo indent.' 207 s = ' Four space indent.\n\n Four space indent.\nNo indent.'
117 summary, content = parseContent(s) 208 summary, content = parseContent(s, 0, 0)
118 self.assertEqual(content, s) 209 self.assertEqual(content, s)
119 210
120 def suite(): 211 def suite():
121 return unittest.makeSuite(MailsplitTestCase, 'test') 212 return unittest.makeSuite(MailsplitTestCase, 'test')
122 213
123 214
124 # 215 #
125 # $Log: not supported by cvs2svn $ 216 # $Log: not supported by cvs2svn $
217 # Revision 1.10 2002/04/23 16:18:18 rochecompaan
218 # Sorry, forgot to checkin modified unit tests for parse email bodies
219 # with and without preservation of quoted text.
220 #
221 # Revision 1.9 2002/01/10 06:19:20 richard
222 # followup lines directly after a quoted section were being eaten.
223 #
126 # Revision 1.8 2001/10/28 23:22:28 richard 224 # Revision 1.8 2001/10/28 23:22:28 richard
127 # fixed bug #474749 ] Indentations lost 225 # fixed bug #474749 ] Indentations lost
128 # 226 #
129 # Revision 1.7 2001/10/23 00:57:32 richard 227 # Revision 1.7 2001/10/23 00:57:32 richard
130 # Removed debug print from mailsplit test. 228 # Removed debug print from mailsplit test.

Roundup Issue Tracker: http://roundup-tracker.org/