Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / html / python / lib / doctest-advanced-api.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-debugging.html" />
13<link rel="prev" href="doctest-unittest-api.html" />
14<link rel="parent" href="module-doctest.html" />
15<link rel="next" href="doctest-DocTest.html" />
16<meta name='aesop' content='information' />
17<title>5.2.6 Advanced API</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.5 Unittest API"
25 href="doctest-unittest-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 doctest "
28 href="module-doctest.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.1 DocTest Objects"
31 href="doctest-DocTest.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-unittest-api.html">5.2.5 Unittest API</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="module-doctest.html">5.2 doctest </A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="doctest-DocTest.html">5.2.6.1 DocTest Objects</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H2><A NAME="SECTION007260000000000000000"></A><A NAME="doctest-advanced-api"></A>
56<BR>
575.2.6 Advanced API
58</H2>
59
60<P>
61The basic API is a simple wrapper that's intended to make doctest easy
62to use. It is fairly flexible, and should meet most users' needs;
63however, if you require more fine-grained control over testing, or
64wish to extend doctest's capabilities, then you should use the
65advanced API.
66
67<P>
68The advanced API revolves around two container classes, which are used
69to store the interactive examples extracted from doctest cases:
70
71<P>
72
73<UL>
74<LI><tt class="class">Example</tt>: A single python statement, paired with its
75 expected output.
76</LI>
77<LI><tt class="class">DocTest</tt>: A collection of <tt class="class">Example</tt>s, typically
78 extracted from a single docstring or text file.
79</LI>
80</UL>
81
82<P>
83Additional processing classes are defined to find, parse, and run, and
84check doctest examples:
85
86<P>
87
88<UL>
89<LI><tt class="class">DocTestFinder</tt>: Finds all docstrings in a given module,
90 and uses a <tt class="class">DocTestParser</tt> to create a <tt class="class">DocTest</tt>
91 from every docstring that contains interactive examples.
92</LI>
93<LI><tt class="class">DocTestParser</tt>: Creates a <tt class="class">DocTest</tt> object from
94 a string (such as an object's docstring).
95</LI>
96<LI><tt class="class">DocTestRunner</tt>: Executes the examples in a
97 <tt class="class">DocTest</tt>, and uses an <tt class="class">OutputChecker</tt> to verify
98 their output.
99</LI>
100<LI><tt class="class">OutputChecker</tt>: Compares the actual output from a
101 doctest example with the expected output, and decides whether
102 they match.
103</LI>
104</UL>
105
106<P>
107The relationships among these processing classes are summarized in the
108following diagram:
109
110<P>
111<div class="verbatim"><pre>
112 list of:
113+------+ +---------+
114|module| --DocTestFinder-&gt; | DocTest | --DocTestRunner-&gt; results
115+------+ | ^ +---------+ | ^ (printed)
116 | | | Example | | |
117 v | | ... | v |
118 DocTestParser | Example | OutputChecker
119 +---------+
120</pre></div>
121
122<P>
123
124<p><br /></p><hr class='online-navigation' />
125<div class='online-navigation'>
126<!--Table of Child-Links-->
127<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a>
128
129<UL CLASS="ChildLinks">
130<LI><A href="doctest-DocTest.html">5.2.6.1 DocTest Objects</a>
131<LI><A href="doctest-Example.html">5.2.6.2 Example Objects</a>
132<LI><A href="doctest-DocTestFinder.html">5.2.6.3 DocTestFinder objects</a>
133<LI><A href="doctest-DocTestParser.html">5.2.6.4 DocTestParser objects</a>
134<LI><A href="doctest-DocTestRunner.html">5.2.6.5 DocTestRunner objects</a>
135<LI><A href="doctest-OutputChecker.html">5.2.6.6 OutputChecker objects</a>
136</ul>
137<!--End of Table of Child-Links-->
138</div>
139
140<DIV CLASS="navigation">
141<div class='online-navigation'>
142<p></p><hr />
143<table align="center" width="100%" cellpadding="0" cellspacing="2">
144<tr>
145<td class='online-navigation'><a rel="prev" title="5.2.5 Unittest API"
146 href="doctest-unittest-api.html"><img src='../icons/previous.png'
147 border='0' height='32' alt='Previous Page' width='32' /></A></td>
148<td class='online-navigation'><a rel="parent" title="5.2 doctest "
149 href="module-doctest.html"><img src='../icons/up.png'
150 border='0' height='32' alt='Up One Level' width='32' /></A></td>
151<td class='online-navigation'><a rel="next" title="5.2.6.1 DocTest Objects"
152 href="doctest-DocTest.html"><img src='../icons/next.png'
153 border='0' height='32' alt='Next Page' width='32' /></A></td>
154<td align="center" width="100%">Python Library Reference</td>
155<td class='online-navigation'><a rel="contents" title="Table of Contents"
156 href="contents.html"><img src='../icons/contents.png'
157 border='0' height='32' alt='Contents' width='32' /></A></td>
158<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
159 border='0' height='32' alt='Module Index' width='32' /></a></td>
160<td class='online-navigation'><a rel="index" title="Index"
161 href="genindex.html"><img src='../icons/index.png'
162 border='0' height='32' alt='Index' width='32' /></A></td>
163</tr></table>
164<div class='online-navigation'>
165<b class="navlabel">Previous:</b>
166<a class="sectref" rel="prev" href="doctest-unittest-api.html">5.2.5 Unittest API</A>
167<b class="navlabel">Up:</b>
168<a class="sectref" rel="parent" href="module-doctest.html">5.2 doctest </A>
169<b class="navlabel">Next:</b>
170<a class="sectref" rel="next" href="doctest-DocTest.html">5.2.6.1 DocTest Objects</A>
171</div>
172</div>
173<hr />
174<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
175</DIV>
176<!--End of Navigation Panel-->
177<ADDRESS>
178See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
179</ADDRESS>
180</BODY>
181</HTML>