[Python-checkins] r45639 - python/trunk/Lib/test/test_old_mailbox.py

andrew.kuchling python-checkins at python.org
Sat Apr 22 04:06:03 CEST 2006


Author: andrew.kuchling
Date: Sat Apr 22 04:06:03 2006
New Revision: 45639

Added:
   python/trunk/Lib/test/test_old_mailbox.py
      - copied, changed from r45597, python/trunk/Lib/test/test_mailbox.py
Log:
Make copy of test_mailbox.py.  We'll still want to check the backward
compatibility classes in the new mailbox.py that I'll be committing in
a few minutes.

One change has been made: the tests use len(mbox) instead of len(mbox.boxes).
The 'boxes' attribute was never documented and contains some internal state
that seems unlikely to have been useful.


Copied: python/trunk/Lib/test/test_old_mailbox.py (from r45597, python/trunk/Lib/test/test_mailbox.py)
==============================================================================
--- python/trunk/Lib/test/test_mailbox.py	(original)
+++ python/trunk/Lib/test/test_old_mailbox.py	Sat Apr 22 04:06:03 2006
@@ -1,3 +1,6 @@
+# This set of tests exercises the backward-compatibility class
+# in mailbox.py (the ones without write support).
+
 import mailbox
 import os
 import time
@@ -63,17 +66,15 @@
     def test_empty_maildir(self):
         """Test an empty maildir mailbox"""
         # Test for regression on bug #117490:
-        # Make sure the boxes attribute actually gets set.
         self.mbox = mailbox.Maildir(test_support.TESTFN)
-        self.assert_(hasattr(self.mbox, "boxes"))
-        self.assert_(len(self.mbox.boxes) == 0)
+        self.assert_(len(self.mbox) == 0)
         self.assert_(self.mbox.next() is None)
         self.assert_(self.mbox.next() is None)
 
     def test_nonempty_maildir_cur(self):
         self.createMessage("cur")
         self.mbox = mailbox.Maildir(test_support.TESTFN)
-        self.assert_(len(self.mbox.boxes) == 1)
+        self.assert_(len(self.mbox) == 1)
         self.assert_(self.mbox.next() is not None)
         self.assert_(self.mbox.next() is None)
         self.assert_(self.mbox.next() is None)
@@ -81,7 +82,7 @@
     def test_nonempty_maildir_new(self):
         self.createMessage("new")
         self.mbox = mailbox.Maildir(test_support.TESTFN)
-        self.assert_(len(self.mbox.boxes) == 1)
+        self.assert_(len(self.mbox) == 1)
         self.assert_(self.mbox.next() is not None)
         self.assert_(self.mbox.next() is None)
         self.assert_(self.mbox.next() is None)
@@ -90,7 +91,7 @@
         self.createMessage("cur")
         self.createMessage("new")
         self.mbox = mailbox.Maildir(test_support.TESTFN)
-        self.assert_(len(self.mbox.boxes) == 2)
+        self.assert_(len(self.mbox) == 2)
         self.assert_(self.mbox.next() is not None)
         self.assert_(self.mbox.next() is not None)
         self.assert_(self.mbox.next() is None)


More information about the Python-checkins mailing list