Back to index

python3.2  3.2.2
Public Member Functions
test.test_mailbox.TestMessageConversion Class Reference
Inheritance diagram for test.test_mailbox.TestMessageConversion:
Inheritance graph
[legend]
Collaboration diagram for test.test_mailbox.TestMessageConversion:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_plain_to_x
def test_x_to_plain
def test_x_from_bytes
def test_x_to_invalid
def test_maildir_to_maildir
def test_maildir_to_mboxmmdf
def test_maildir_to_mh
def test_maildir_to_babyl
def test_mboxmmdf_to_maildir
def test_mboxmmdf_to_mboxmmdf
def test_mboxmmdf_to_mh
def test_mboxmmdf_to_babyl
def test_mh_to_maildir
def test_mh_to_mboxmmdf
def test_mh_to_mh
def test_mh_to_babyl
def test_babyl_to_maildir
def test_babyl_to_mboxmmdf
def test_babyl_to_mh
def test_babyl_to_babyl

Detailed Description

Definition at line 1539 of file test_mailbox.py.


Member Function Documentation

Definition at line 1781 of file test_mailbox.py.

01781 
01782     def test_babyl_to_babyl(self):
01783         # Convert BabylMessage to BabylMessage
01784         msg = mailbox.BabylMessage(_sample_message)
01785         msg.update_visible()
01786         for label in ('unseen', 'deleted', 'filed', 'answered', 'forwarded',
01787                       'edited', 'resent'):
01788             msg.add_label(label)
01789         msg2 = mailbox.BabylMessage(msg)
01790         self.assertEqual(msg2.get_labels(), ['unseen', 'deleted', 'filed',
01791                                              'answered', 'forwarded', 'edited',
01792                                              'resent'])
01793         self.assertEqual(msg.get_visible().keys(), msg2.get_visible().keys())
01794         for key in msg.get_visible().keys():
01795             self.assertEqual(msg.get_visible()[key], msg2.get_visible()[key])
01796 

Here is the call graph for this function:

Definition at line 1731 of file test_mailbox.py.

01731 
01732     def test_babyl_to_maildir(self):
01733         # Convert BabylMessage to MaildirMessage
01734         pairs = (('unseen', ''), ('deleted', 'ST'), ('filed', 'S'),
01735                  ('answered', 'RS'), ('forwarded', 'PS'), ('edited', 'S'),
01736                  ('resent', 'PS'))
01737         for setting, result in pairs:
01738             msg = mailbox.BabylMessage(_sample_message)
01739             msg.add_label(setting)
01740             self.assertEqual(mailbox.MaildirMessage(msg).get_flags(), result)
01741             self.assertEqual(mailbox.MaildirMessage(msg).get_subdir(), 'cur')
01742         msg = mailbox.BabylMessage(_sample_message)
01743         for label in ('unseen', 'deleted', 'filed', 'answered', 'forwarded',
01744                       'edited', 'resent'):
01745             msg.add_label(label)
01746         self.assertEqual(mailbox.MaildirMessage(msg).get_flags(), 'PRT')
01747         self.assertEqual(mailbox.MaildirMessage(msg).get_subdir(), 'cur')

Here is the call graph for this function:

Definition at line 1748 of file test_mailbox.py.

01748 
01749     def test_babyl_to_mboxmmdf(self):
01750         # Convert BabylMessage to mboxMessage and MMDFMessage
01751         pairs = (('unseen', 'O'), ('deleted', 'ROD'), ('filed', 'RO'),
01752                  ('answered', 'ROA'), ('forwarded', 'RO'), ('edited', 'RO'),
01753                  ('resent', 'RO'))
01754         for setting, result in pairs:
01755             for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
01756                 msg = mailbox.BabylMessage(_sample_message)
01757                 msg.add_label(setting)
01758                 self.assertEqual(class_(msg).get_flags(), result)
01759         msg = mailbox.BabylMessage(_sample_message)
01760         for label in ('unseen', 'deleted', 'filed', 'answered', 'forwarded',
01761                       'edited', 'resent'):
01762             msg.add_label(label)
01763         for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
01764             self.assertEqual(class_(msg).get_flags(), 'ODA')

Here is the call graph for this function:

Definition at line 1765 of file test_mailbox.py.

01765 
01766     def test_babyl_to_mh(self):
01767         # Convert BabylMessage to MHMessage
01768         pairs = (('unseen', ['unseen']), ('deleted', []), ('filed', []),
01769                  ('answered', ['replied']), ('forwarded', []), ('edited', []),
01770                  ('resent', []))
01771         for setting, result in pairs:
01772             msg = mailbox.BabylMessage(_sample_message)
01773             msg.add_label(setting)
01774             self.assertEqual(mailbox.MHMessage(msg).get_sequences(), result)
01775         msg = mailbox.BabylMessage(_sample_message)
01776         for label in ('unseen', 'deleted', 'filed', 'answered', 'forwarded',
01777                       'edited', 'resent'):
01778             msg.add_label(label)
01779         self.assertEqual(mailbox.MHMessage(msg).get_sequences(),
01780                          ['unseen', 'replied'])

Here is the call graph for this function:

Definition at line 1613 of file test_mailbox.py.

01613 
01614     def test_maildir_to_babyl(self):
01615         # Convert MaildirMessage to Babyl
01616         msg_maildir = mailbox.MaildirMessage(_sample_message)
01617         pairs = (('D', ['unseen']), ('F', ['unseen']),
01618                  ('P', ['unseen', 'forwarded']), ('R', ['unseen', 'answered']),
01619                  ('S', []), ('T', ['unseen', 'deleted']),
01620                  ('DFPRST', ['deleted', 'answered', 'forwarded']))
01621         for setting, result in pairs:
01622             msg_maildir.set_flags(setting)
01623             self.assertEqual(mailbox.BabylMessage(msg_maildir).get_labels(),
01624                              result)

Here is the call graph for this function:

Definition at line 1574 of file test_mailbox.py.

01574 
01575     def test_maildir_to_maildir(self):
01576         # Convert MaildirMessage to MaildirMessage
01577         msg_maildir = mailbox.MaildirMessage(_sample_message)
01578         msg_maildir.set_flags('DFPRST')
01579         msg_maildir.set_subdir('cur')
01580         date = msg_maildir.get_date()
01581         msg = mailbox.MaildirMessage(msg_maildir)
01582         self._check_sample(msg)
01583         self.assertEqual(msg.get_flags(), 'DFPRST')
01584         self.assertEqual(msg.get_subdir(), 'cur')
01585         self.assertEqual(msg.get_date(), date)

Here is the call graph for this function:

Definition at line 1586 of file test_mailbox.py.

01586 
01587     def test_maildir_to_mboxmmdf(self):
01588         # Convert MaildirMessage to mboxmessage and MMDFMessage
01589         pairs = (('D', ''), ('F', 'F'), ('P', ''), ('R', 'A'), ('S', 'R'),
01590                  ('T', 'D'), ('DFPRST', 'RDFA'))
01591         for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
01592             msg_maildir = mailbox.MaildirMessage(_sample_message)
01593             msg_maildir.set_date(0.0)
01594             for setting, result in pairs:
01595                 msg_maildir.set_flags(setting)
01596                 msg = class_(msg_maildir)
01597                 self.assertEqual(msg.get_flags(), result)
01598                 self.assertEqual(msg.get_from(), 'MAILER-DAEMON %s' %
01599                              time.asctime(time.gmtime(0.0)))
01600             msg_maildir.set_subdir('cur')
01601             self.assertEqual(class_(msg_maildir).get_flags(), 'RODFA')

Here is the call graph for this function:

Definition at line 1602 of file test_mailbox.py.

01602 
01603     def test_maildir_to_mh(self):
01604         # Convert MaildirMessage to MHMessage
01605         msg_maildir = mailbox.MaildirMessage(_sample_message)
01606         pairs = (('D', ['unseen']), ('F', ['unseen', 'flagged']),
01607                  ('P', ['unseen']), ('R', ['unseen', 'replied']), ('S', []),
01608                  ('T', ['unseen']), ('DFPRST', ['replied', 'flagged']))
01609         for setting, result in pairs:
01610             msg_maildir.set_flags(setting)
01611             self.assertEqual(mailbox.MHMessage(msg_maildir).get_sequences(),
01612                              result)

Here is the call graph for this function:

Definition at line 1665 of file test_mailbox.py.

01665 
01666     def test_mboxmmdf_to_babyl(self):
01667         # Convert mboxMessage and MMDFMessage to BabylMessage
01668         for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
01669             msg = class_(_sample_message)
01670             pairs = (('R', []), ('O', ['unseen']),
01671                      ('D', ['unseen', 'deleted']), ('F', ['unseen']),
01672                      ('A', ['unseen', 'answered']),
01673                      ('RODFA', ['deleted', 'answered']))
01674             for setting, result in pairs:
01675                 msg.set_flags(setting)
01676                 self.assertEqual(mailbox.BabylMessage(msg).get_labels(), result)

Here is the call graph for this function:

Definition at line 1625 of file test_mailbox.py.

01625 
01626     def test_mboxmmdf_to_maildir(self):
01627         # Convert mboxMessage and MMDFMessage to MaildirMessage
01628         for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
01629             msg_mboxMMDF = class_(_sample_message)
01630             msg_mboxMMDF.set_from('foo@bar', time.gmtime(0.0))
01631             pairs = (('R', 'S'), ('O', ''), ('D', 'T'), ('F', 'F'), ('A', 'R'),
01632                      ('RODFA', 'FRST'))
01633             for setting, result in pairs:
01634                 msg_mboxMMDF.set_flags(setting)
01635                 msg = mailbox.MaildirMessage(msg_mboxMMDF)
01636                 self.assertEqual(msg.get_flags(), result)
01637                 self.assertEqual(msg.get_date(), 0.0)
01638             msg_mboxMMDF.set_flags('O')
01639             self.assertEqual(mailbox.MaildirMessage(msg_mboxMMDF).get_subdir(),
01640                              'cur')

Here is the call graph for this function:

Definition at line 1641 of file test_mailbox.py.

01641 
01642     def test_mboxmmdf_to_mboxmmdf(self):
01643         # Convert mboxMessage and MMDFMessage to mboxMessage and MMDFMessage
01644         for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
01645             msg_mboxMMDF = class_(_sample_message)
01646             msg_mboxMMDF.set_flags('RODFA')
01647             msg_mboxMMDF.set_from('foo@bar')
01648             for class2_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
01649                 msg2 = class2_(msg_mboxMMDF)
01650                 self.assertEqual(msg2.get_flags(), 'RODFA')
01651                 self.assertEqual(msg2.get_from(), 'foo@bar')

Here is the call graph for this function:

Definition at line 1652 of file test_mailbox.py.

01652 
01653     def test_mboxmmdf_to_mh(self):
01654         # Convert mboxMessage and MMDFMessage to MHMessage
01655         for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
01656             msg_mboxMMDF = class_(_sample_message)
01657             pairs = (('R', []), ('O', ['unseen']), ('D', ['unseen']),
01658                      ('F', ['unseen', 'flagged']),
01659                      ('A', ['unseen', 'replied']),
01660                      ('RODFA', ['replied', 'flagged']))
01661             for setting, result in pairs:
01662                 msg_mboxMMDF.set_flags(setting)
01663                 self.assertEqual(mailbox.MHMessage(msg_mboxMMDF).get_sequences(),
01664                                  result)

Here is the call graph for this function:

Definition at line 1716 of file test_mailbox.py.

01716 
01717     def test_mh_to_babyl(self):
01718         # Convert MHMessage to BabylMessage
01719         pairs = (('unseen', ['unseen']), ('replied', ['answered']),
01720                  ('flagged', []))
01721         for setting, result in pairs:
01722             msg = mailbox.MHMessage(_sample_message)
01723             msg.add_sequence(setting)
01724             self.assertEqual(mailbox.BabylMessage(msg).get_labels(), result)
01725         msg = mailbox.MHMessage(_sample_message)
01726         msg.add_sequence('unseen')
01727         msg.add_sequence('replied')
01728         msg.add_sequence('flagged')
01729         self.assertEqual(mailbox.BabylMessage(msg).get_labels(),
01730                          ['unseen', 'answered'])

Here is the call graph for this function:

Definition at line 1677 of file test_mailbox.py.

01677 
01678     def test_mh_to_maildir(self):
01679         # Convert MHMessage to MaildirMessage
01680         pairs = (('unseen', ''), ('replied', 'RS'), ('flagged', 'FS'))
01681         for setting, result in pairs:
01682             msg = mailbox.MHMessage(_sample_message)
01683             msg.add_sequence(setting)
01684             self.assertEqual(mailbox.MaildirMessage(msg).get_flags(), result)
01685             self.assertEqual(mailbox.MaildirMessage(msg).get_subdir(), 'cur')
01686         msg = mailbox.MHMessage(_sample_message)
01687         msg.add_sequence('unseen')
01688         msg.add_sequence('replied')
01689         msg.add_sequence('flagged')
01690         self.assertEqual(mailbox.MaildirMessage(msg).get_flags(), 'FR')
01691         self.assertEqual(mailbox.MaildirMessage(msg).get_subdir(), 'cur')

Here is the call graph for this function:

Definition at line 1692 of file test_mailbox.py.

01692 
01693     def test_mh_to_mboxmmdf(self):
01694         # Convert MHMessage to mboxMessage and MMDFMessage
01695         pairs = (('unseen', 'O'), ('replied', 'ROA'), ('flagged', 'ROF'))
01696         for setting, result in pairs:
01697             msg = mailbox.MHMessage(_sample_message)
01698             msg.add_sequence(setting)
01699             for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
01700                 self.assertEqual(class_(msg).get_flags(), result)
01701         msg = mailbox.MHMessage(_sample_message)
01702         msg.add_sequence('unseen')
01703         msg.add_sequence('replied')
01704         msg.add_sequence('flagged')
01705         for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage):
01706             self.assertEqual(class_(msg).get_flags(), 'OFA')

Here is the call graph for this function:

Definition at line 1707 of file test_mailbox.py.

01707 
01708     def test_mh_to_mh(self):
01709         # Convert MHMessage to MHMessage
01710         msg = mailbox.MHMessage(_sample_message)
01711         msg.add_sequence('unseen')
01712         msg.add_sequence('replied')
01713         msg.add_sequence('flagged')
01714         self.assertEqual(mailbox.MHMessage(msg).get_sequences(),
01715                          ['unseen', 'replied', 'flagged'])

Here is the call graph for this function:

Definition at line 1541 of file test_mailbox.py.

01541 
01542     def test_plain_to_x(self):
01543         # Convert Message to all formats
01544         for class_ in (mailbox.Message, mailbox.MaildirMessage,
01545                        mailbox.mboxMessage, mailbox.MHMessage,
01546                        mailbox.BabylMessage, mailbox.MMDFMessage):
01547             msg_plain = mailbox.Message(_sample_message)
01548             msg = class_(msg_plain)
01549             self._check_sample(msg)

Here is the call graph for this function:

Definition at line 1559 of file test_mailbox.py.

01559 
01560     def test_x_from_bytes(self):
01561         # Convert all formats to Message
01562         for class_ in (mailbox.Message, mailbox.MaildirMessage,
01563                        mailbox.mboxMessage, mailbox.MHMessage,
01564                        mailbox.BabylMessage, mailbox.MMDFMessage):
01565             msg = class_(_bytes_sample_message)
01566             self._check_sample(msg)

Here is the call graph for this function:

Definition at line 1567 of file test_mailbox.py.

01567 
01568     def test_x_to_invalid(self):
01569         # Convert all formats to an invalid format
01570         for class_ in (mailbox.Message, mailbox.MaildirMessage,
01571                        mailbox.mboxMessage, mailbox.MHMessage,
01572                        mailbox.BabylMessage, mailbox.MMDFMessage):
01573             self.assertRaises(TypeError, lambda: class_(False))

Here is the call graph for this function:

Definition at line 1550 of file test_mailbox.py.

01550 
01551     def test_x_to_plain(self):
01552         # Convert all formats to Message
01553         for class_ in (mailbox.Message, mailbox.MaildirMessage,
01554                        mailbox.mboxMessage, mailbox.MHMessage,
01555                        mailbox.BabylMessage, mailbox.MMDFMessage):
01556             msg = class_(_sample_message)
01557             msg_plain = mailbox.Message(msg)
01558             self._check_sample(msg_plain)

Here is the call graph for this function:


The documentation for this class was generated from the following file: