summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_mailbox.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_mailbox.py')
-rw-r--r--Lib/test/test_mailbox.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py
index a714255..918116a 100644
--- a/Lib/test/test_mailbox.py
+++ b/Lib/test/test_mailbox.py
@@ -506,6 +506,20 @@ class TestMaildir(TestMailbox):
self.assertEqual(msg_returned.get_flags(), 'S')
self.assertEqual(msg_returned.get_payload(), '3')
+ def test_consistent_factory(self):
+ # Add a message.
+ msg = mailbox.MaildirMessage(self._template % 0)
+ msg.set_subdir('cur')
+ msg.set_flags('RF')
+ key = self._box.add(msg)
+
+ # Create new mailbox with
+ class FakeMessage(mailbox.MaildirMessage):
+ pass
+ box = mailbox.Maildir(self._path, factory=FakeMessage)
+ msg2 = box.get_message(key)
+ self.assert_(isinstance(msg2, FakeMessage))
+
def test_initialize_new(self):
# Initialize a non-existent mailbox
self.tearDown()