Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="next" href="doctest-Example.html" /> | |
13 | <link rel="prev" href="doctest-advanced-api.html" /> | |
14 | <link rel="parent" href="doctest-advanced-api.html" /> | |
15 | <link rel="next" href="doctest-Example.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>5.2.6.1 DocTest Objects</title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="5.2.6 Advanced API" | |
25 | href="doctest-advanced-api.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="5.2.6 Advanced API" | |
28 | href="doctest-advanced-api.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="5.2.6.2 Example Objects" | |
31 | href="doctest-Example.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="doctest-advanced-api.html">5.2.6 Advanced API</A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="doctest-advanced-api.html">5.2.6 Advanced API</A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="doctest-Example.html">5.2.6.2 Example Objects</A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H3><A NAME="SECTION007261000000000000000"></A><A NAME="doctest-DocTest"></A> | |
56 | <BR> | |
57 | 5.2.6.1 DocTest Objects | |
58 | </H3> | |
59 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
60 | <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-1080' xml:id='l2h-1080' class="class">DocTest</tt></b>(</nobr></td> | |
61 | <td><var>examples, globs, name, filename, lineno, | |
62 | docstring</var>)</td></tr></table></dt> | |
63 | <dd> | |
64 | A collection of doctest examples that should be run in a single | |
65 | namespace. The constructor arguments are used to initialize the | |
66 | member variables of the same names. | |
67 | ||
68 | <span class="versionnote">New in version 2.4.</span> | |
69 | ||
70 | </dl> | |
71 | ||
72 | <P> | |
73 | <tt class="class">DocTest</tt> defines the following member variables. They are | |
74 | initialized by the constructor, and should not be modified directly. | |
75 | ||
76 | <P> | |
77 | <dl><dt><b><tt id='l2h-1081' xml:id='l2h-1081' class="member">examples</tt></b></dt> | |
78 | <dd> | |
79 | A list of <tt class="class">Example</tt> objects encoding the individual | |
80 | interactive Python examples that should be run by this test. | |
81 | </dl> | |
82 | ||
83 | <P> | |
84 | <dl><dt><b><tt id='l2h-1082' xml:id='l2h-1082' class="member">globs</tt></b></dt> | |
85 | <dd> | |
86 | The namespace (aka globals) that the examples should be run in. | |
87 | This is a dictionary mapping names to values. Any changes to the | |
88 | namespace made by the examples (such as binding new variables) | |
89 | will be reflected in <tt class="member">globs</tt> after the test is run. | |
90 | </dl> | |
91 | ||
92 | <P> | |
93 | <dl><dt><b><tt id='l2h-1083' xml:id='l2h-1083' class="member">name</tt></b></dt> | |
94 | <dd> | |
95 | A string name identifying the <tt class="class">DocTest</tt>. Typically, this is | |
96 | the name of the object or file that the test was extracted from. | |
97 | </dl> | |
98 | ||
99 | <P> | |
100 | <dl><dt><b><tt id='l2h-1084' xml:id='l2h-1084' class="member">filename</tt></b></dt> | |
101 | <dd> | |
102 | The name of the file that this <tt class="class">DocTest</tt> was extracted from; | |
103 | or <code>None</code> if the filename is unknown, or if the | |
104 | <tt class="class">DocTest</tt> was not extracted from a file. | |
105 | </dl> | |
106 | ||
107 | <P> | |
108 | <dl><dt><b><tt id='l2h-1085' xml:id='l2h-1085' class="member">lineno</tt></b></dt> | |
109 | <dd> | |
110 | The line number within <tt class="member">filename</tt> where this | |
111 | <tt class="class">DocTest</tt> begins, or <code>None</code> if the line number is | |
112 | unavailable. This line number is zero-based with respect to the | |
113 | beginning of the file. | |
114 | </dl> | |
115 | ||
116 | <P> | |
117 | <dl><dt><b><tt id='l2h-1086' xml:id='l2h-1086' class="member">docstring</tt></b></dt> | |
118 | <dd> | |
119 | The string that the test was extracted from, or `None` if the | |
120 | string is unavailable, or if the test was not extracted from a | |
121 | string. | |
122 | </dl> | |
123 | ||
124 | <P> | |
125 | ||
126 | <DIV CLASS="navigation"> | |
127 | <div class='online-navigation'> | |
128 | <p></p><hr /> | |
129 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
130 | <tr> | |
131 | <td class='online-navigation'><a rel="prev" title="5.2.6 Advanced API" | |
132 | href="doctest-advanced-api.html"><img src='../icons/previous.png' | |
133 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
134 | <td class='online-navigation'><a rel="parent" title="5.2.6 Advanced API" | |
135 | href="doctest-advanced-api.html"><img src='../icons/up.png' | |
136 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
137 | <td class='online-navigation'><a rel="next" title="5.2.6.2 Example Objects" | |
138 | href="doctest-Example.html"><img src='../icons/next.png' | |
139 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
140 | <td align="center" width="100%">Python Library Reference</td> | |
141 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
142 | href="contents.html"><img src='../icons/contents.png' | |
143 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
144 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
145 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
146 | <td class='online-navigation'><a rel="index" title="Index" | |
147 | href="genindex.html"><img src='../icons/index.png' | |
148 | border='0' height='32' alt='Index' width='32' /></A></td> | |
149 | </tr></table> | |
150 | <div class='online-navigation'> | |
151 | <b class="navlabel">Previous:</b> | |
152 | <a class="sectref" rel="prev" href="doctest-advanced-api.html">5.2.6 Advanced API</A> | |
153 | <b class="navlabel">Up:</b> | |
154 | <a class="sectref" rel="parent" href="doctest-advanced-api.html">5.2.6 Advanced API</A> | |
155 | <b class="navlabel">Next:</b> | |
156 | <a class="sectref" rel="next" href="doctest-Example.html">5.2.6.2 Example Objects</A> | |
157 | </div> | |
158 | </div> | |
159 | <hr /> | |
160 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
161 | </DIV> | |
162 | <!--End of Navigation Panel--> | |
163 | <ADDRESS> | |
164 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
165 | </ADDRESS> | |
166 | </BODY> | |
167 | </HTML> |