[Python-checkins] cpython (merge 3.5 -> default): Closes #27209: Merge with 3.5
zach.ware
python-checkins at python.org
Wed Aug 10 01:40:32 EDT 2016
https://hg.python.org/cpython/rev/81dc2d250209
changeset: 102598:81dc2d250209
parent: 102596:76c04e780cd5
parent: 102597:bb443518141e
user: Zachary Ware <zachary.ware at gmail.com>
date: Wed Aug 10 00:39:59 2016 -0500
summary:
Closes #27209: Merge with 3.5
files:
Doc/library/email.iterators.rst | 10 +++---
Doc/library/email.message.rst | 20 +++++++-------
Doc/library/email.policy.rst | 29 ++++++++++----------
3 files changed, 29 insertions(+), 30 deletions(-)
diff --git a/Doc/library/email.iterators.rst b/Doc/library/email.iterators.rst
--- a/Doc/library/email.iterators.rst
+++ b/Doc/library/email.iterators.rst
@@ -50,9 +50,9 @@
.. testsetup::
- >>> import email
- >>> from email.iterators import _structure
- >>> somefile = open('Lib/test/test_email/data/msg_02.txt')
+ import email
+ from email.iterators import _structure
+ somefile = open('../Lib/test/test_email/data/msg_02.txt')
.. doctest::
@@ -74,9 +74,9 @@
text/plain
text/plain
- .. testsetup::
+ .. testcleanup::
- >>> somefile.close()
+ somefile.close()
Optional *fp* is a file-like object to print the output to. It must be
suitable for Python's :func:`print` function. *level* is used internally.
diff --git a/Doc/library/email.message.rst b/Doc/library/email.message.rst
--- a/Doc/library/email.message.rst
+++ b/Doc/library/email.message.rst
@@ -602,10 +602,10 @@
.. testsetup::
- >>> from email import message_from_binary_file
- >>> with open('Lib/test/test_email/data/msg_16.txt', 'rb') as f:
- ... msg = message_from_binary_file(f)
- >>> from email.iterators import _structure
+ from email import message_from_binary_file
+ with open('../Lib/test/test_email/data/msg_16.txt', 'rb') as f:
+ msg = message_from_binary_file(f)
+ from email.iterators import _structure
.. doctest::
@@ -628,7 +628,7 @@
.. doctest::
>>> for part in msg.walk():
- ... print(part.get_content_maintype() == 'multipart'),
+ ... print(part.get_content_maintype() == 'multipart',
... part.is_multipart())
True True
False False
@@ -640,11 +640,11 @@
>>> _structure(msg)
multipart/report
text/plain
- message/delivery-status
- text/plain
- text/plain
- message/rfc822
- text/plain
+ message/delivery-status
+ text/plain
+ text/plain
+ message/rfc822
+ text/plain
Here the ``message`` parts are not ``multiparts``, but they do contain
subparts. ``is_multipart()`` returns ``True`` and ``walk`` descends
diff --git a/Doc/library/email.policy.rst b/Doc/library/email.policy.rst
--- a/Doc/library/email.policy.rst
+++ b/Doc/library/email.policy.rst
@@ -63,16 +63,15 @@
.. testsetup::
- >>> from unittest import mock
- >>> mocker = mock.patch('subprocess.Popen')
- >>> m = mocker.start()
- >>> proc = mock.MagicMock()
- >>> m.return_value = proc
- >>> proc.stdin.close.return_value = None
- >>> mymsg = open('mymsg.txt', 'w')
- >>> mymsg.write('To: abc at xyz.com\n\n')
- 17
- >>> mymsg.flush()
+ from unittest import mock
+ mocker = mock.patch('subprocess.Popen')
+ m = mocker.start()
+ proc = mock.MagicMock()
+ m.return_value = proc
+ proc.stdin.close.return_value = None
+ mymsg = open('mymsg.txt', 'w')
+ mymsg.write('To: abc at xyz.com\n\n')
+ mymsg.flush()
.. doctest::
@@ -88,12 +87,12 @@
>>> p.stdin.close()
>>> rc = p.wait()
-.. testsetup::
+.. testcleanup::
- >>> mymsg.close()
- >>> mocker.stop()
- >>> import os
- >>> os.remove('mymsg.txt')
+ mymsg.close()
+ mocker.stop()
+ import os
+ os.remove('mymsg.txt')
Here we are telling :class:`~email.generator.BytesGenerator` to use the RFC
correct line separator characters when creating the binary string to feed into
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list