Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Side by Side Diff: Doc/library/doctest.rst

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Doc/library/dis.rst ('k') | Doc/library/email.util.rst » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`doctest` --- Test interactive Python examples 1 :mod:`doctest` --- Test interactive Python examples
2 =================================================== 2 ===================================================
3 3
4 .. module:: doctest 4 .. module:: doctest
5 :synopsis: Test pieces of code within docstrings. 5 :synopsis: Test pieces of code within docstrings.
6 .. moduleauthor:: Tim Peters <tim@python.org> 6 .. moduleauthor:: Tim Peters <tim@python.org>
7 .. sectionauthor:: Tim Peters <tim@python.org> 7 .. sectionauthor:: Tim Peters <tim@python.org>
8 .. sectionauthor:: Moshe Zadka <moshez@debian.org> 8 .. sectionauthor:: Moshe Zadka <moshez@debian.org>
9 .. sectionauthor:: Edward Loper <edloper@users.sourceforge.net> 9 .. sectionauthor:: Edward Loper <edloper@users.sourceforge.net>
10 10
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 1120
1121 .. _doctest-doctest: 1121 .. _doctest-doctest:
1122 1122
1123 DocTest Objects 1123 DocTest Objects
1124 ^^^^^^^^^^^^^^^ 1124 ^^^^^^^^^^^^^^^
1125 1125
1126 1126
1127 .. class:: DocTest(examples, globs, name, filename, lineno, docstring) 1127 .. class:: DocTest(examples, globs, name, filename, lineno, docstring)
1128 1128
1129 A collection of doctest examples that should be run in a single namespace. T he 1129 A collection of doctest examples that should be run in a single namespace. T he
1130 constructor arguments are used to initialize the attributes of the same names . 1130 constructor arguments are used to initialize the member variables of the same
1131 names.
1131 1132
1132 1133
1133 :class:`DocTest` defines the following attributes. They are initialized by 1134 :class:`DocTest` defines the following member variables. They are initialize d by
1134 the constructor, and should not be modified directly. 1135 the constructor, and should not be modified directly.
1135 1136
1136 1137
1137 .. attribute:: examples 1138 .. attribute:: examples
1138 1139
1139 A list of :class:`Example` objects encoding the individual interactive Pyt hon 1140 A list of :class:`Example` objects encoding the individual interactive Pyt hon
1140 examples that should be run by this test. 1141 examples that should be run by this test.
1141 1142
1142 1143
1143 .. attribute:: globs 1144 .. attribute:: globs
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 1177
1177 .. _doctest-example: 1178 .. _doctest-example:
1178 1179
1179 Example Objects 1180 Example Objects
1180 ^^^^^^^^^^^^^^^ 1181 ^^^^^^^^^^^^^^^
1181 1182
1182 1183
1183 .. class:: Example(source, want, exc_msg=None, lineno=0, indent=0, options=None) 1184 .. class:: Example(source, want, exc_msg=None, lineno=0, indent=0, options=None)
1184 1185
1185 A single interactive example, consisting of a Python statement and its expect ed 1186 A single interactive example, consisting of a Python statement and its expect ed
1186 output. The constructor arguments are used to initialize the attributes of 1187 output. The constructor arguments are used to initialize the member variable s
1187 the same names. 1188 of the same names.
1188 1189
1189 1190
1190 :class:`Example` defines the following attributes. They are initialized by 1191 :class:`Example` defines the following member variables. They are initialize d by
1191 the constructor, and should not be modified directly. 1192 the constructor, and should not be modified directly.
1192 1193
1193 1194
1194 .. attribute:: source 1195 .. attribute:: source
1195 1196
1196 A string containing the example's source code. This source code consists of a 1197 A string containing the example's source code. This source code consists of a
1197 single Python statement, and always ends with a newline; the constructor a dds 1198 single Python statement, and always ends with a newline; the constructor a dds
1198 a newline when necessary. 1199 a newline when necessary.
1199 1200
1200 1201
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 For information about the constructor parameters and methods, see the 1668 For information about the constructor parameters and methods, see the
1668 documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-ap i`. 1669 documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-ap i`.
1669 1670
1670 There are two exceptions that may be raised by :class:`DebugRunner` instances: 1671 There are two exceptions that may be raised by :class:`DebugRunner` instances:
1671 1672
1672 1673
1673 .. exception:: DocTestFailure(test, example, got) 1674 .. exception:: DocTestFailure(test, example, got)
1674 1675
1675 An exception raised by :class:`DocTestRunner` to signal that a doctest exampl e's 1676 An exception raised by :class:`DocTestRunner` to signal that a doctest exampl e's
1676 actual output did not match its expected output. The constructor arguments ar e 1677 actual output did not match its expected output. The constructor arguments ar e
1677 used to initialize the attributes of the same names. 1678 used to initialize the member variables of the same names.
1678 1679
1679 :exc:`DocTestFailure` defines the following attributes: 1680 :exc:`DocTestFailure` defines the following member variables:
1680 1681
1681 1682
1682 .. attribute:: DocTestFailure.test 1683 .. attribute:: DocTestFailure.test
1683 1684
1684 The :class:`DocTest` object that was being run when the example failed. 1685 The :class:`DocTest` object that was being run when the example failed.
1685 1686
1686 1687
1687 .. attribute:: DocTestFailure.example 1688 .. attribute:: DocTestFailure.example
1688 1689
1689 The :class:`Example` that failed. 1690 The :class:`Example` that failed.
1690 1691
1691 1692
1692 .. attribute:: DocTestFailure.got 1693 .. attribute:: DocTestFailure.got
1693 1694
1694 The example's actual output. 1695 The example's actual output.
1695 1696
1696 1697
1697 .. exception:: UnexpectedException(test, example, exc_info) 1698 .. exception:: UnexpectedException(test, example, exc_info)
1698 1699
1699 An exception raised by :class:`DocTestRunner` to signal that a doctest 1700 An exception raised by :class:`DocTestRunner` to signal that a doctest
1700 example raised an unexpected exception. The constructor arguments are used 1701 example raised an unexpected exception. The constructor arguments are used
1701 to initialize the attributes of the same names. 1702 to initialize the member variables of the same names.
1702 1703
1703 :exc:`UnexpectedException` defines the following attributes: 1704 :exc:`UnexpectedException` defines the following member variables:
1704 1705
1705 1706
1706 .. attribute:: UnexpectedException.test 1707 .. attribute:: UnexpectedException.test
1707 1708
1708 The :class:`DocTest` object that was being run when the example failed. 1709 The :class:`DocTest` object that was being run when the example failed.
1709 1710
1710 1711
1711 .. attribute:: UnexpectedException.example 1712 .. attribute:: UnexpectedException.example
1712 1713
1713 The :class:`Example` that failed. 1714 The :class:`Example` that failed.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1776 the same file as the module, or separated out into a separate test file. 1777 the same file as the module, or separated out into a separate test file.
1777 1778
1778 * Define a ``__test__`` dictionary mapping from regression test topics to 1779 * Define a ``__test__`` dictionary mapping from regression test topics to
1779 docstrings containing test cases. 1780 docstrings containing test cases.
1780 1781
1781 .. rubric:: Footnotes 1782 .. rubric:: Footnotes
1782 1783
1783 .. [#] Examples containing both expected output and an exception are not support ed. 1784 .. [#] Examples containing both expected output and an exception are not support ed.
1784 Trying to guess where one ends and the other begins is too error-prone, and t hat 1785 Trying to guess where one ends and the other begins is too error-prone, and t hat
1785 also makes for a confusing test. 1786 also makes for a confusing test.
OLDNEW
« no previous file with comments | « Doc/library/dis.rst ('k') | Doc/library/email.util.rst » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+