MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //usr/share/doc/python-docs-2.4.3/html/lib/doctest-DocTestFinder.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index' />
<link rel="first" href="lib.html" title='Python Library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="doctest-DocTestParser.html" />
<link rel="prev" href="doctest-Example.html" />
<link rel="parent" href="doctest-advanced-api.html" />
<link rel="next" href="doctest-DocTestParser.html" />
<meta name='aesop' content='information' />
<title>5.2.6.3 DocTestFinder objects</title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="5.2.6.2 Example Objects"
  href="doctest-Example.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="5.2.6 Advanced API"
  href="doctest-advanced-api.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="5.2.6.4 DocTestParser objects"
  href="doctest-DocTestParser.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="doctest-Example.html">5.2.6.2 Example Objects</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="doctest-advanced-api.html">5.2.6 Advanced API</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="doctest-DocTestParser.html">5.2.6.4 DocTestParser objects</A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->

<H3><A NAME="SECTION007263000000000000000"></A><A NAME="doctest-DocTestFinder"></A>
<BR>
5.2.6.3 DocTestFinder objects
</H3>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-1094' xml:id='l2h-1094' class="class">DocTestFinder</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>verbose</var><big>]</big><var></var><big>[</big><var>,
                                parser</var><big>]</big><var></var><big>[</big><var>, recurse</var><big>]</big><var></var><big>[</big><var>,
                                exclude_empty</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
    A processing class used to extract the <tt class="class">DocTest</tt>s that are
    relevant to a given object, from its docstring and the docstrings
    of its contained objects.  <tt class="class">DocTest</tt>s can currently be
    extracted from the following object types: modules, functions,
    classes, methods, staticmethods, classmethods, and properties.

<P>
The optional argument <var>verbose</var> can be used to display the
    objects searched by the finder.  It defaults to <code>False</code> (no
    output).

<P>
The optional argument <var>parser</var> specifies the
    <tt class="class">DocTestParser</tt> object (or a drop-in replacement) that is
    used to extract doctests from docstrings.

<P>
If the optional argument <var>recurse</var> is false, then
    <tt class="method">DocTestFinder.find()</tt> will only examine the given object,
    and not any contained objects.

<P>
If the optional argument <var>exclude_empty</var> is false, then
    <tt class="method">DocTestFinder.find()</tt> will include tests for objects with
    empty docstrings.

<P>

<span class="versionnote">New in version 2.4.</span>

</dl>

<P>
<tt class="class">DocTestFinder</tt> defines the following method:

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1095' xml:id='l2h-1095' class="method">find</tt></b>(</nobr></td>
  <td><var>obj</var><big>[</big><var>, name</var><big>]</big><var></var><big>[</big><var>,
                   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>
<dd>
    Return a list of the <tt class="class">DocTest</tt>s that are defined by
    <var>obj</var>'s docstring, or by any of its contained objects'
    docstrings.

<P>
The optional argument <var>name</var> specifies the object's name; this
    name will be used to construct names for the returned
    <tt class="class">DocTest</tt>s.  If <var>name</var> is not specified, then
    <code><var>obj</var>.__name__</code> is used.

<P>
The optional parameter <var>module</var> is the module that contains
    the given object.  If the module is not specified or is None, then
    the test finder will attempt to automatically determine the
    correct module.  The object's module is used:

<P>

<UL>
<LI>As a default namespace, if <var>globs</var> is not specified.
</LI>
<LI>To prevent the DocTestFinder from extracting DocTests
          from objects that are imported from other modules.  (Contained
          objects with modules other than <var>module</var> are ignored.)
</LI>
<LI>To find the name of the file containing the object.
</LI>
<LI>To help find the line number of the object within its file.
    
</LI>
</UL>

<P>
If <var>module</var> is <code>False</code>, no attempt to find the module
    will be made.  This is obscure, of use mostly in testing doctest
    itself: if <var>module</var> is <code>False</code>, or is <code>None</code> but
    cannot be found automatically, then all objects are considered to
    belong to the (non-existent) module, so all contained objects will
    (recursively) be searched for doctests.

<P>
The globals for each <tt class="class">DocTest</tt> is formed by combining
    <var>globs</var> and <var>extraglobs</var> (bindings in <var>extraglobs</var>
    override bindings in <var>globs</var>).  A new shallow copy of the globals
    dictionary is created for each <tt class="class">DocTest</tt>.  If <var>globs</var> is
    not specified, then it defaults to the module's <var>__dict__</var>, if
    specified, or <code>{}</code> otherwise.  If <var>extraglobs</var> is not
    specified, then it defaults to <code>{}</code>.
</dl>

<P>

<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="5.2.6.2 Example Objects"
  href="doctest-Example.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="5.2.6 Advanced API"
  href="doctest-advanced-api.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="5.2.6.4 DocTestParser objects"
  href="doctest-DocTestParser.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="doctest-Example.html">5.2.6.2 Example Objects</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="doctest-advanced-api.html">5.2.6 Advanced API</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="doctest-DocTestParser.html">5.2.6.4 DocTestParser objects</A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.3, documentation updated on 29 March 2006.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>