Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c988e242
Commit
c988e242
authored
Apr 08, 2012
by
R David Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove redundancy in listing of all mailbox classes in test_mailbox.
parent
409d0a9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
15 deletions
+9
-15
Lib/test/test_mailbox.py
Lib/test/test_mailbox.py
+9
-15
No files found.
Lib/test/test_mailbox.py
View file @
c988e242
...
...
@@ -22,6 +22,10 @@ except ImportError:
class
TestBase
:
all_mailbox_types
=
(
mailbox
.
Message
,
mailbox
.
MaildirMessage
,
mailbox
.
mboxMessage
,
mailbox
.
MHMessage
,
mailbox
.
BabylMessage
,
mailbox
.
MMDFMessage
)
def
_check_sample
(
self
,
msg
):
# Inspect a mailbox.Message representation of the sample message
self
.
assertIsInstance
(
msg
,
email
.
message
.
Message
)
...
...
@@ -1337,9 +1341,7 @@ class TestMessage(TestBase, unittest.TestCase):
# Copy self's format-specific data to other message formats.
# This test is superficial; better ones are in TestMessageConversion.
msg
=
self
.
_factory
()
for
class_
in
(
mailbox
.
Message
,
mailbox
.
MaildirMessage
,
mailbox
.
mboxMessage
,
mailbox
.
MHMessage
,
mailbox
.
BabylMessage
,
mailbox
.
MMDFMessage
):
for
class_
in
self
.
all_mailbox_types
:
other_msg
=
class_
()
msg
.
_explain_to
(
other_msg
)
other_msg
=
email
.
message
.
Message
()
...
...
@@ -1571,35 +1573,27 @@ class TestMessageConversion(TestBase, unittest.TestCase):
def
test_plain_to_x
(
self
):
# Convert Message to all formats
for
class_
in
(
mailbox
.
Message
,
mailbox
.
MaildirMessage
,
mailbox
.
mboxMessage
,
mailbox
.
MHMessage
,
mailbox
.
BabylMessage
,
mailbox
.
MMDFMessage
):
for
class_
in
self
.
all_mailbox_types
:
msg_plain
=
mailbox
.
Message
(
_sample_message
)
msg
=
class_
(
msg_plain
)
self
.
_check_sample
(
msg
)
def
test_x_to_plain
(
self
):
# Convert all formats to Message
for
class_
in
(
mailbox
.
Message
,
mailbox
.
MaildirMessage
,
mailbox
.
mboxMessage
,
mailbox
.
MHMessage
,
mailbox
.
BabylMessage
,
mailbox
.
MMDFMessage
):
for
class_
in
self
.
all_mailbox_types
:
msg
=
class_
(
_sample_message
)
msg_plain
=
mailbox
.
Message
(
msg
)
self
.
_check_sample
(
msg_plain
)
def
test_x_from_bytes
(
self
):
# Convert all formats to Message
for
class_
in
(
mailbox
.
Message
,
mailbox
.
MaildirMessage
,
mailbox
.
mboxMessage
,
mailbox
.
MHMessage
,
mailbox
.
BabylMessage
,
mailbox
.
MMDFMessage
):
for
class_
in
self
.
all_mailbox_types
:
msg
=
class_
(
_bytes_sample_message
)
self
.
_check_sample
(
msg
)
def
test_x_to_invalid
(
self
):
# Convert all formats to an invalid format
for
class_
in
(
mailbox
.
Message
,
mailbox
.
MaildirMessage
,
mailbox
.
mboxMessage
,
mailbox
.
MHMessage
,
mailbox
.
BabylMessage
,
mailbox
.
MMDFMessage
):
for
class_
in
self
.
all_mailbox_types
:
self
.
assertRaises
(
TypeError
,
lambda
:
class_
(
False
))
def
test_maildir_to_maildir
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment