[Spambayes-checkins] spambayes/spambayes/test test_sb_imapfilter.py, 1.4, 1.5

Tony Meyer anadelonbrin at users.sourceforge.net
Fri Nov 5 03:36:28 CET 2004


Update of /cvsroot/spambayes/spambayes/spambayes/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19506/spambayes/test

Modified Files:
	test_sb_imapfilter.py 
Log Message:
Fix typo in import.

The test failed with Python 2.2 - not because sb_imapfilter did, but because there
 were lots of "if substr in string" instances in the test script.  Replace those with
 find() != -1 so that the test can be run with 2.2.

Index: test_sb_imapfilter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/test/test_sb_imapfilter.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** test_sb_imapfilter.py	14 Oct 2004 04:01:10 -0000	1.4
--- test_sb_imapfilter.py	5 Nov 2004 02:36:25 -0000	1.5
***************
*** 15,19 ****
  from spambayes import Dibbler
  from spambayes.Options import options
! from spambayes.classifier import Classifer
  from sb_imapfilter import BadIMAPResponseError
  from spambayes.message import message_from_string
--- 15,19 ----
  from spambayes import Dibbler
  from spambayes.Options import options
! from spambayes.classifier import Classifier
  from sb_imapfilter import BadIMAPResponseError
  from spambayes.message import message_from_string
***************
*** 89,94 ****
  
  class TestListener(Dibbler.Listener):
!     """Listener for TestIMAP4Server.  Works on port 8143, to co-exist
!     with real IMAP4 servers."""
      def __init__(self, socketMap=asyncore.socket_map):
          Dibbler.Listener.__init__(self, IMAP_PORT, TestIMAP4Server,
--- 89,93 ----
  
  class TestListener(Dibbler.Listener):
!     """Listener for TestIMAP4Server."""
      def __init__(self, socketMap=asyncore.socket_map):
          Dibbler.Listener.__init__(self, IMAP_PORT, TestIMAP4Server,
***************
*** 239,243 ****
          args = args.upper()
          results = ()
!         if "UNDELETED" in args:
              for msg_id in UNDELETED_IDS:
                  if uid:
--- 238,242 ----
          args = args.upper()
          results = ()
!         if args.find("UNDELETED") != -1:
              for msg_id in UNDELETED_IDS:
                  if uid:
***************
*** 259,263 ****
          for msg in msg_nums:
              response[msg] = []
!         if "UID" in msg_parts:
              if uid:
                  for msg in msg_nums:
--- 258,262 ----
          for msg in msg_nums:
              response[msg] = []
!         if msg_parts.find("UID") != -1:
              if uid:
                  for msg in msg_nums:
***************
*** 267,271 ****
                      response[msg].append("FETCH (UID %s)" %
                                           (IMAP_UIDS[int(msg)]))
!         if "BODY.PEEK[]" in msg_parts:
              for msg in msg_nums:
                  if uid:
--- 266,270 ----
                      response[msg].append("FETCH (UID %s)" %
                                           (IMAP_UIDS[int(msg)]))
!         if msg_parts.find("BODY.PEEK[]") != -1:
              for msg in msg_nums:
                  if uid:
***************
*** 276,280 ****
                                       (len(IMAP_MESSAGES[msg_uid])),
                                       IMAP_MESSAGES[msg_uid]))
!         if "RFC822.HEADER" in msg_parts:
              for msg in msg_nums:
                  if uid:
--- 275,279 ----
                                       (len(IMAP_MESSAGES[msg_uid])),
                                       IMAP_MESSAGES[msg_uid]))
!         if msg_parts.find("RFC822.HEADER") != -1:
              for msg in msg_nums:
                  if uid:
***************
*** 286,290 ****
                  response[msg].append(("FETCH (RFC822.HEADER {%s}" %
                                        (len(headers),), headers))
!         if "FLAGS INTERNALDATE" in msg_parts:
              # We make up flags & dates.
              for msg in msg_nums:
--- 285,289 ----
                  response[msg].append(("FETCH (RFC822.HEADER {%s}" %
                                        (len(headers),), headers))
!         if msg_parts.find("FLAGS INTERNALDATE") != -1:
              # We make up flags & dates.
              for msg in msg_nums:
***************
*** 514,518 ****
          # message 103 is replaced with one that does, this will fail with
          # Python 2.4/email 3.0.
!         has_header = "X-Spambayes-Exception: " in new_msg.as_string()
          has_defect = hasattr(new_msg, "defects") and len(new_msg.defects) > 0
          self.assert_(has_header or has_defect)
--- 513,517 ----
          # message 103 is replaced with one that does, this will fail with
          # Python 2.4/email 3.0.
!         has_header = new_msg.as_string().find("X-Spambayes-Exception: ") != -1
          has_defect = hasattr(new_msg, "defects") and len(new_msg.defects) > 0
          self.assert_(has_header or has_defect)



More information about the Spambayes-checkins mailing list