Lines Matching refs:mailbox
14 import mailbox
27 # Inspect a mailbox.Message representation of the sample message
29 self.assertIsInstance(msg, mailbox.Message)
37 self.assertNotIsInstance(part, mailbox.Message)
67 keys.append(self._box.add(mailbox.Message(_sample_message)))
166 self.assertIsInstance(msg0, mailbox.Message)
419 # Lock and unlock the mailbox
427 # Close mailbox and flush changes to disk
466 # Test that all Mailbox methods raise NotImplementedException.
467 box = mailbox.Mailbox('path')
500 _factory = lambda self, path, factory=None: mailbox.Maildir(path, factory)
509 msg = mailbox.MaildirMessage(self._template % 0)
518 msg = mailbox.MaildirMessage(self._template % 0)
523 self.assertIsInstance(msg_returned, mailbox.MaildirMessage)
529 msg0 = mailbox.MaildirMessage(self._template % 0)
535 msg1 = mailbox.MaildirMessage(self._template % 1)
541 msg2 = mailbox.MaildirMessage(self._template % 2)
552 msg = mailbox.MaildirMessage(self._template % 0)
557 # Create new mailbox with
558 class FakeMessage(mailbox.MaildirMessage):
560 box = mailbox.Maildir(self._path, factory=FakeMessage)
566 # Initialize a non-existent mailbox
568 self._box = mailbox.Maildir(self._path)
575 # Initialize an existing mailbox
579 self._box = mailbox.Maildir(self._path)
581 self._box = mailbox.Maildir(self._path, factory=None)
746 # Lock and unlock the mailbox. For Maildir, this does nothing.
766 self._box.add(mailbox.Message(_sample_message))
779 msg = mailbox.MaildirMessage(self._template % 0)
853 # mailbox file. See issue #9559.
874 # Make the mailbox world writable. It's unlikely that the new
875 # mailbox file would have these permissions after flush(),
898 # Add a string starting with 'From ' to the mailbox
905 for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
910 # Open and inspect previously-created mailbox
924 # Verifying that closing a mailbox doesn't change added items
940 # Fork off a child process that will lock the mailbox temporarily,
950 # lock the mailbox, and signal the parent it can proceed
954 # wait until the parent is done, and unlock the mailbox
960 # In the parent, wait until the child signals it locked the mailbox.
963 self.assertRaises(mailbox.ExternalClashError,
975 # Test case for bug #1575506: the mailbox class was locking the
992 _factory = lambda self, path, factory=None: mailbox.mbox(path, factory)
995 # From bug #3228, we want to verify that the mailbox file isn't executable,
1003 self._box = mailbox.mbox(self._path, create=True)
1038 _factory = lambda self, path, factory=None: mailbox.MMDF(path, factory)
1043 _factory = lambda self, path, factory=None: mailbox.MH(path, factory)
1095 msg0 = mailbox.MHMessage(self._template % 0)
1099 msg1 = mailbox.MHMessage(self._template % 1)
1113 msg0 = mailbox.MHMessage(self._template % 0)
1119 msg0 = mailbox.MHMessage(self._template % 0)
1126 # Pack the contents of the mailbox
1127 msg0 = mailbox.MHMessage(self._template % 0)
1128 msg1 = mailbox.MHMessage(self._template % 1)
1129 msg2 = mailbox.MHMessage(self._template % 2)
1130 msg3 = mailbox.MHMessage(self._template % 3)
1154 # Test case for packing while holding the mailbox locked.
1175 _factory = lambda self, path, factory=None: mailbox.Babyl(path, factory)
1184 # Get labels from the mailbox
1186 msg0 = mailbox.BabylMessage(self._template % 0)
1190 msg1 = mailbox.BabylMessage(self._template % 1)
1204 _factory = mailbox.Message # Overridden by subclasses to reuse tests
1239 self.assertIsInstance(msg, mailbox.Message)
1260 for class_ in (mailbox.Message, mailbox.MaildirMessage,
1261 mailbox.mboxMessage, mailbox.MHMessage,
1262 mailbox.BabylMessage, mailbox.MMDFMessage):
1275 _factory = mailbox.MaildirMessage
1283 msg = mailbox.MaildirMessage(_sample_message)
1297 msg = mailbox.MaildirMessage(_sample_message)
1314 msg = mailbox.MaildirMessage(_sample_message)
1322 msg = mailbox.MaildirMessage(_sample_message)
1331 msg = mailbox.MaildirMessage(_sample_message)
1350 _factory = mailbox._mboxMMDFMessage
1357 msg = mailbox.Message(_sample_message)
1359 msg = mailbox.mboxMessage(msg)
1364 msg = mailbox.mboxMessage(_sample_message)
1375 msg = mailbox.mboxMessage(_sample_message)
1397 _factory = mailbox.mboxMessage
1402 _factory = mailbox.MHMessage
1409 msg = mailbox.MHMessage(_sample_message)
1433 _factory = mailbox.BabylMessage
1440 msg = mailbox.BabylMessage(_sample_message)
1463 msg = mailbox.BabylMessage(_sample_message)
1488 _factory = mailbox.MMDFMessage
1495 for class_ in (mailbox.Message, mailbox.MaildirMessage,
1496 mailbox.mboxMessage, mailbox.MHMessage,
1497 mailbox.BabylMessage, mailbox.MMDFMessage):
1498 msg_plain = mailbox.Message(_sample_message)
1504 for class_ in (mailbox.Message, mailbox.MaildirMessage,
1505 mailbox.mboxMessage, mailbox.MHMessage,
1506 mailbox.BabylMessage, mailbox.MMDFMessage):
1508 msg_plain = mailbox.Message(msg)
1513 for class_ in (mailbox.Message, mailbox.MaildirMessage,
1514 mailbox.mboxMessage, mailbox.MHMessage,
1515 mailbox.BabylMessage, mailbox.MMDFMessage):
1520 msg_maildir = mailbox.MaildirMessage(_sample_message)
1524 msg = mailbox.MaildirMessage(msg_maildir)
1534 for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
1535 msg_maildir = mailbox.MaildirMessage(_sample_message)
1548 msg_maildir = mailbox.MaildirMessage(_sample_message)
1554 self.assertEqual(mailbox.MHMessage(msg_maildir).get_sequences(),
1559 msg_maildir = mailbox.MaildirMessage(_sample_message)
1566 self.assertEqual(mailbox.BabylMessage(msg_maildir).get_labels(),
1571 for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
1578 msg = mailbox.MaildirMessage(msg_mboxMMDF)
1582 self.assertEqual(mailbox.MaildirMessage(msg_mboxMMDF).get_subdir(),
1587 for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
1591 for class2_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
1598 for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
1606 self.assertEqual(mailbox.MHMessage(msg_mboxMMDF).get_sequences(),
1611 for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
1619 self.assertEqual(mailbox.BabylMessage(msg).get_labels(), result)
1625 msg = mailbox.MHMessage(_sample_message)
1627 self.assertEqual(mailbox.MaildirMessage(msg).get_flags(), result)
1628 self.assertEqual(mailbox.MaildirMessage(msg).get_subdir(), 'cur')
1629 msg = mailbox.MHMessage(_sample_message)
1633 self.assertEqual(mailbox.MaildirMessage(msg).get_flags(), 'FR')
1634 self.assertEqual(mailbox.MaildirMessage(msg).get_subdir(), 'cur')
1640 msg = mailbox.MHMessage(_sample_message)
1642 for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
1644 msg = mailbox.MHMessage(_sample_message)
1648 for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
1653 msg = mailbox.MHMessage(_sample_message)
1657 self.assertEqual(mailbox.MHMessage(msg).get_sequences(),
1665 msg = mailbox.MHMessage(_sample_message)
1667 self.assertEqual(mailbox.BabylMessage(msg).get_labels(), result)
1668 msg = mailbox.MHMessage(_sample_message)
1672 self.assertEqual(mailbox.BabylMessage(msg).get_labels(),
1681 msg = mailbox.BabylMessage(_sample_message)
1683 self.assertEqual(mailbox.MaildirMessage(msg).get_flags(), result)
1684 self.assertEqual(mailbox.MaildirMessage(msg).get_subdir(), 'cur')
1685 msg = mailbox.BabylMessage(_sample_message)
1689 self.assertEqual(mailbox.MaildirMessage(msg).get_flags(), 'PRT')
1690 self.assertEqual(mailbox.MaildirMessage(msg).get_subdir(), 'cur')
1698 for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
1699 msg = mailbox.BabylMessage(_sample_message)
1702 msg = mailbox.BabylMessage(_sample_message)
1706 for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
1715 msg = mailbox.BabylMessage(_sample_message)
1717 self.assertEqual(mailbox.MHMessage(msg).get_sequences(), result)
1718 msg = mailbox.BabylMessage(_sample_message)
1722 self.assertEqual(mailbox.MHMessage(msg).get_sequences(),
1727 msg = mailbox.BabylMessage(_sample_message)
1732 msg2 = mailbox.BabylMessage(msg)
1828 proxy0 = mailbox._ProxyFile(self._file)
1831 proxy1 = mailbox._ProxyFile(self._file, 0)
1837 self._test_read(mailbox._ProxyFile(self._file))
1842 self._test_readline(mailbox._ProxyFile(self._file))
1847 self._test_readlines(mailbox._ProxyFile(self._file))
1852 self._test_iteration(mailbox._ProxyFile(self._file))
1856 self._test_seek_and_tell(mailbox._ProxyFile(self._file))
1860 self._test_close(mailbox._ProxyFile(self._file))
1877 proxy = mailbox._PartialFile(self._file, 2, 5)
1883 self._test_read(mailbox._PartialFile(self._file, 3, 6))
1888 self._test_readline(mailbox._PartialFile(self._file, 5,
1894 self._test_readlines(mailbox._PartialFile(self._file, 0,
1900 self._test_iteration(mailbox._PartialFile(self._file, 4,
1905 self._test_seek_and_tell(mailbox._PartialFile(self._file, 3,
1910 self._test_close(mailbox._PartialFile(self._file, 1,
1928 # create a new maildir mailbox to work with:
1969 """Test an empty maildir mailbox"""
1972 self.mbox = mailbox.Maildir(test_support.TESTFN)
1980 self.mbox = mailbox.Maildir(test_support.TESTFN)
1990 self.mbox = mailbox.Maildir(test_support.TESTFN)
2001 self.mbox = mailbox.Maildir(test_support.TESTFN)
2018 for msg in mailbox.PortableUnixMailbox(fid,