comparison test/test_mailgw.py @ 668:4afa9be56dd3

for python2.1 test_mailgw compareString... ...allows an extra trailing empty line (for quopri.
author Engelbert Gruber <grubert@users.sourceforge.net>
date Tue, 19 Mar 2002 21:58:11 +0000
parents d1567c2433c4
children 676d4cfde9a5 54333751e98d
comparison
equal deleted inserted replaced
667:52ca0ae46044 668:4afa9be56dd3
6 # 6 #
7 # This module is distributed in the hope that it will be useful, 7 # This module is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # 10 #
11 # $Id: test_mailgw.py,v 1.15 2002-03-19 06:37:00 richard Exp $ 11 # $Id: test_mailgw.py,v 1.16 2002-03-19 21:58:11 grubert Exp $
12 12
13 import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib 13 import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib
14 14
15 from roundup.mailgw import MailGW 15 from roundup.mailgw import MailGW
16 from roundup import init, instance 16 from roundup import init, instance
23 the first to be the "original" but in the calls in this file, 23 the first to be the "original" but in the calls in this file,
24 the second arg is the original. Ho hum. 24 the second arg is the original. Ho hum.
25 ''' 25 '''
26 if s1 == s2: 26 if s1 == s2:
27 return 27 return
28 # under python2.1 we allow a difference of one trailing empty line.
29 if sys.version_info[0:2] == (2,1):
30 if s1+'\n' == s2:
31 return
32
28 l1=s1.split('\n') 33 l1=s1.split('\n')
29 l2=s2.split('\n') 34 l2=s2.split('\n')
30 s = difflib.SequenceMatcher(None, l1, l2) 35 s = difflib.SequenceMatcher(None, l1, l2)
31 res = ['Generated message not correct (diff follows):'] 36 res = ['Generated message not correct (diff follows):']
32 for value, s1s, s1e, s2s, s2e in s.get_opcodes(): 37 for value, s1s, s1e, s2s, s2e in s.get_opcodes():
424 return unittest.TestSuite(l) 429 return unittest.TestSuite(l)
425 430
426 431
427 # 432 #
428 # $Log: not supported by cvs2svn $ 433 # $Log: not supported by cvs2svn $
434 # Revision 1.15 2002/03/19 06:37:00 richard
435 # Made the email checking spit out a diff - much easier to spot the problem!
436 #
429 # Revision 1.14 2002/03/18 18:32:00 rochecompaan 437 # Revision 1.14 2002/03/18 18:32:00 rochecompaan
430 # All messages sent to the nosy list are now encoded as quoted-printable. 438 # All messages sent to the nosy list are now encoded as quoted-printable.
431 # 439 #
432 # Revision 1.13 2002/02/15 07:08:45 richard 440 # Revision 1.13 2002/02/15 07:08:45 richard
433 # . Alternate email addresses are now available for users. See the MIGRATION 441 # . Alternate email addresses are now available for users. See the MIGRATION

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