Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / html / python / lib / doctest-DocTestFinder.html
CommitLineData
920dae64
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-DocTestParser.html" />
13<link rel="prev" href="doctest-Example.html" />
14<link rel="parent" href="doctest-advanced-api.html" />
15<link rel="next" href="doctest-DocTestParser.html" />
16<meta name='aesop' content='information' />
17<title>5.2.6.3 DocTestFinder 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.2 Example Objects"
25 href="doctest-Example.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.4 DocTestParser objects"
31 href="doctest-DocTestParser.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-Example.html">5.2.6.2 Example Objects</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-DocTestParser.html">5.2.6.4 DocTestParser objects</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H3><A NAME="SECTION007263000000000000000"></A><A NAME="doctest-DocTestFinder"></A>
56<BR>
575.2.6.3 DocTestFinder objects
58</H3>
59<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
60 <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-1094' xml:id='l2h-1094' class="class">DocTestFinder</tt></b>(</nobr></td>
61 <td><var></var><big>[</big><var>verbose</var><big>]</big><var></var><big>[</big><var>,
62 parser</var><big>]</big><var></var><big>[</big><var>, recurse</var><big>]</big><var></var><big>[</big><var>,
63 exclude_empty</var><big>]</big><var></var>)</td></tr></table></dt>
64<dd>
65 A processing class used to extract the <tt class="class">DocTest</tt>s that are
66 relevant to a given object, from its docstring and the docstrings
67 of its contained objects. <tt class="class">DocTest</tt>s can currently be
68 extracted from the following object types: modules, functions,
69 classes, methods, staticmethods, classmethods, and properties.
70
71<P>
72The optional argument <var>verbose</var> can be used to display the
73 objects searched by the finder. It defaults to <code>False</code> (no
74 output).
75
76<P>
77The optional argument <var>parser</var> specifies the
78 <tt class="class">DocTestParser</tt> object (or a drop-in replacement) that is
79 used to extract doctests from docstrings.
80
81<P>
82If the optional argument <var>recurse</var> is false, then
83 <tt class="method">DocTestFinder.find()</tt> will only examine the given object,
84 and not any contained objects.
85
86<P>
87If the optional argument <var>exclude_empty</var> is false, then
88 <tt class="method">DocTestFinder.find()</tt> will include tests for objects with
89 empty docstrings.
90
91<P>
92
93<span class="versionnote">New in version 2.4.</span>
94
95</dl>
96
97<P>
98<tt class="class">DocTestFinder</tt> defines the following method:
99
100<P>
101<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
102 <td><nobr><b><tt id='l2h-1095' xml:id='l2h-1095' class="method">find</tt></b>(</nobr></td>
103 <td><var>obj</var><big>[</big><var>, name</var><big>]</big><var></var><big>[</big><var>,
104 module</var><big>]</big><var></var><big>[</big><var>, globs</var><big>]</big><var></var><big>[</big><var>, extraglobs</var><big>]</big><var></var>)</td></tr></table></dt>
105<dd>
106 Return a list of the <tt class="class">DocTest</tt>s that are defined by
107 <var>obj</var>'s docstring, or by any of its contained objects'
108 docstrings.
109
110<P>
111The optional argument <var>name</var> specifies the object's name; this
112 name will be used to construct names for the returned
113 <tt class="class">DocTest</tt>s. If <var>name</var> is not specified, then
114 <code><var>obj</var>.__name__</code> is used.
115
116<P>
117The optional parameter <var>module</var> is the module that contains
118 the given object. If the module is not specified or is None, then
119 the test finder will attempt to automatically determine the
120 correct module. The object's module is used:
121
122<P>
123
124<UL>
125<LI>As a default namespace, if <var>globs</var> is not specified.
126</LI>
127<LI>To prevent the DocTestFinder from extracting DocTests
128 from objects that are imported from other modules. (Contained
129 objects with modules other than <var>module</var> are ignored.)
130</LI>
131<LI>To find the name of the file containing the object.
132</LI>
133<LI>To help find the line number of the object within its file.
134
135</LI>
136</UL>
137
138<P>
139If <var>module</var> is <code>False</code>, no attempt to find the module
140 will be made. This is obscure, of use mostly in testing doctest
141 itself: if <var>module</var> is <code>False</code>, or is <code>None</code> but
142 cannot be found automatically, then all objects are considered to
143 belong to the (non-existent) module, so all contained objects will
144 (recursively) be searched for doctests.
145
146<P>
147The globals for each <tt class="class">DocTest</tt> is formed by combining
148 <var>globs</var> and <var>extraglobs</var> (bindings in <var>extraglobs</var>
149 override bindings in <var>globs</var>). A new shallow copy of the globals
150 dictionary is created for each <tt class="class">DocTest</tt>. If <var>globs</var> is
151 not specified, then it defaults to the module's <var>__dict__</var>, if
152 specified, or <code>{}</code> otherwise. If <var>extraglobs</var> is not
153 specified, then it defaults to <code>{}</code>.
154</dl>
155
156<P>
157
158<DIV CLASS="navigation">
159<div class='online-navigation'>
160<p></p><hr />
161<table align="center" width="100%" cellpadding="0" cellspacing="2">
162<tr>
163<td class='online-navigation'><a rel="prev" title="5.2.6.2 Example Objects"
164 href="doctest-Example.html"><img src='../icons/previous.png'
165 border='0' height='32' alt='Previous Page' width='32' /></A></td>
166<td class='online-navigation'><a rel="parent" title="5.2.6 Advanced API"
167 href="doctest-advanced-api.html"><img src='../icons/up.png'
168 border='0' height='32' alt='Up One Level' width='32' /></A></td>
169<td class='online-navigation'><a rel="next" title="5.2.6.4 DocTestParser objects"
170 href="doctest-DocTestParser.html"><img src='../icons/next.png'
171 border='0' height='32' alt='Next Page' width='32' /></A></td>
172<td align="center" width="100%">Python Library Reference</td>
173<td class='online-navigation'><a rel="contents" title="Table of Contents"
174 href="contents.html"><img src='../icons/contents.png'
175 border='0' height='32' alt='Contents' width='32' /></A></td>
176<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
177 border='0' height='32' alt='Module Index' width='32' /></a></td>
178<td class='online-navigation'><a rel="index" title="Index"
179 href="genindex.html"><img src='../icons/index.png'
180 border='0' height='32' alt='Index' width='32' /></A></td>
181</tr></table>
182<div class='online-navigation'>
183<b class="navlabel">Previous:</b>
184<a class="sectref" rel="prev" href="doctest-Example.html">5.2.6.2 Example Objects</A>
185<b class="navlabel">Up:</b>
186<a class="sectref" rel="parent" href="doctest-advanced-api.html">5.2.6 Advanced API</A>
187<b class="navlabel">Next:</b>
188<a class="sectref" rel="next" href="doctest-DocTestParser.html">5.2.6.4 DocTestParser objects</A>
189</div>
190</div>
191<hr />
192<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
193</DIV>
194<!--End of Navigation Panel-->
195<ADDRESS>
196See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
197</ADDRESS>
198</BODY>
199</HTML>