summaryrefslogtreecommitdiffstats
path: root/Doc/library/email.policy.rst
diff options
context:
space:
mode:
authorZachary Ware <zachary.ware@gmail.com>2016-08-10 05:39:41 (GMT)
committerZachary Ware <zachary.ware@gmail.com>2016-08-10 05:39:41 (GMT)
commit640b1ca50779cd40427a4ebfe8ea56f58a0d935d (patch)
treeac6900567e4dcf40030bc5b5a9b0159c94b8c383 /Doc/library/email.policy.rst
parentc90fccdff6f5e72f1e4ff09ba1ba7697f70b0f4b (diff)
downloadcpython-640b1ca50779cd40427a4ebfe8ea56f58a0d935d.zip
cpython-640b1ca50779cd40427a4ebfe8ea56f58a0d935d.tar.gz
cpython-640b1ca50779cd40427a4ebfe8ea56f58a0d935d.tar.bz2
Issue #27209: Fix doctests in Doc/library/email*.rst
Patch by Jelle Zijlstra.
Diffstat (limited to 'Doc/library/email.policy.rst')
-rw-r--r--Doc/library/email.policy.rst29
1 files changed, 14 insertions, 15 deletions
diff --git a/Doc/library/email.policy.rst b/Doc/library/email.policy.rst
index 47f3212..2a6047d 100644
--- a/Doc/library/email.policy.rst
+++ b/Doc/library/email.policy.rst
@@ -63,16 +63,15 @@ file on disk and pass it to the system ``sendmail`` program on a Unix system:
.. 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@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@xyz.com\n\n')
+ mymsg.flush()
.. doctest::
@@ -88,12 +87,12 @@ file on disk and pass it to the system ``sendmail`` program on a Unix system:
>>> 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