Commit | Line | Data |
---|---|---|
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="prev" href="doctest-DocTestRunner.html" /> | |
13 | <link rel="parent" href="doctest-advanced-api.html" /> | |
14 | <link rel="next" href="doctest-debugging.html" /> | |
15 | <meta name='aesop' content='information' /> | |
16 | <title>5.2.6.6 OutputChecker objects</title> | |
17 | </head> | |
18 | <body> | |
19 | <DIV CLASS="navigation"> | |
20 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
21 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
22 | <tr> | |
23 | <td class='online-navigation'><a rel="prev" title="5.2.6.5 DocTestRunner objects" | |
24 | href="doctest-DocTestRunner.html"><img src='../icons/previous.png' | |
25 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
26 | <td class='online-navigation'><a rel="parent" title="5.2.6 Advanced API" | |
27 | href="doctest-advanced-api.html"><img src='../icons/up.png' | |
28 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
29 | <td class='online-navigation'><a rel="next" title="5.2.7 Debugging" | |
30 | href="doctest-debugging.html"><img src='../icons/next.png' | |
31 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
32 | <td align="center" width="100%">Python Library Reference</td> | |
33 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
34 | href="contents.html"><img src='../icons/contents.png' | |
35 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
36 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
37 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
38 | <td class='online-navigation'><a rel="index" title="Index" | |
39 | href="genindex.html"><img src='../icons/index.png' | |
40 | border='0' height='32' alt='Index' width='32' /></A></td> | |
41 | </tr></table> | |
42 | <div class='online-navigation'> | |
43 | <b class="navlabel">Previous:</b> | |
44 | <a class="sectref" rel="prev" href="doctest-DocTestRunner.html">5.2.6.5 DocTestRunner objects</A> | |
45 | <b class="navlabel">Up:</b> | |
46 | <a class="sectref" rel="parent" href="doctest-advanced-api.html">5.2.6 Advanced API</A> | |
47 | <b class="navlabel">Next:</b> | |
48 | <a class="sectref" rel="next" href="doctest-debugging.html">5.2.7 Debugging</A> | |
49 | </div> | |
50 | <hr /></div> | |
51 | </DIV> | |
52 | <!--End of Navigation Panel--> | |
53 | ||
54 | <H3><A NAME="SECTION007266000000000000000"></A><A NAME="doctest-OutputChecker"></A> | |
55 | <BR> | |
56 | 5.2.6.6 OutputChecker objects | |
57 | </H3> | |
58 | ||
59 | <P> | |
60 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
61 | <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-1107' xml:id='l2h-1107' class="class">OutputChecker</tt></b>(</nobr></td> | |
62 | <td><var></var>)</td></tr></table></dt> | |
63 | <dd> | |
64 | A class used to check the whether the actual output from a doctest | |
65 | example matches the expected output. <tt class="class">OutputChecker</tt> | |
66 | defines two methods: <tt class="method">check_output</tt>, which compares a given | |
67 | pair of outputs, and returns true if they match; and | |
68 | <tt class="method">output_difference</tt>, which returns a string describing the | |
69 | differences between two outputs. | |
70 | ||
71 | <span class="versionnote">New in version 2.4.</span> | |
72 | ||
73 | </dl> | |
74 | ||
75 | <P> | |
76 | <tt class="class">OutputChecker</tt> defines the following methods: | |
77 | ||
78 | <P> | |
79 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
80 | <td><nobr><b><tt id='l2h-1108' xml:id='l2h-1108' class="method">check_output</tt></b>(</nobr></td> | |
81 | <td><var>want, got, optionflags</var>)</td></tr></table></dt> | |
82 | <dd> | |
83 | Return <code>True</code> iff the actual output from an example | |
84 | (<var>got</var>) matches the expected output (<var>want</var>). These | |
85 | strings are always considered to match if they are identical; but | |
86 | depending on what option flags the test runner is using, several | |
87 | non-exact match types are also possible. See | |
88 | section <A href="doctest-options.html#doctest-options">5.2.3</A> for more information about option | |
89 | flags. | |
90 | </dl> | |
91 | ||
92 | <P> | |
93 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
94 | <td><nobr><b><tt id='l2h-1109' xml:id='l2h-1109' class="method">output_difference</tt></b>(</nobr></td> | |
95 | <td><var>example, got, optionflags</var>)</td></tr></table></dt> | |
96 | <dd> | |
97 | Return a string describing the differences between the expected | |
98 | output for a given example (<var>example</var>) and the actual output | |
99 | (<var>got</var>). <var>optionflags</var> is the set of option flags used to | |
100 | compare <var>want</var> and <var>got</var>. | |
101 | </dl> | |
102 | ||
103 | <P> | |
104 | ||
105 | <DIV CLASS="navigation"> | |
106 | <div class='online-navigation'> | |
107 | <p></p><hr /> | |
108 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
109 | <tr> | |
110 | <td class='online-navigation'><a rel="prev" title="5.2.6.5 DocTestRunner objects" | |
111 | href="doctest-DocTestRunner.html"><img src='../icons/previous.png' | |
112 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
113 | <td class='online-navigation'><a rel="parent" title="5.2.6 Advanced API" | |
114 | href="doctest-advanced-api.html"><img src='../icons/up.png' | |
115 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
116 | <td class='online-navigation'><a rel="next" title="5.2.7 Debugging" | |
117 | href="doctest-debugging.html"><img src='../icons/next.png' | |
118 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
119 | <td align="center" width="100%">Python Library Reference</td> | |
120 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
121 | href="contents.html"><img src='../icons/contents.png' | |
122 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
123 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
124 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
125 | <td class='online-navigation'><a rel="index" title="Index" | |
126 | href="genindex.html"><img src='../icons/index.png' | |
127 | border='0' height='32' alt='Index' width='32' /></A></td> | |
128 | </tr></table> | |
129 | <div class='online-navigation'> | |
130 | <b class="navlabel">Previous:</b> | |
131 | <a class="sectref" rel="prev" href="doctest-DocTestRunner.html">5.2.6.5 DocTestRunner objects</A> | |
132 | <b class="navlabel">Up:</b> | |
133 | <a class="sectref" rel="parent" href="doctest-advanced-api.html">5.2.6 Advanced API</A> | |
134 | <b class="navlabel">Next:</b> | |
135 | <a class="sectref" rel="next" href="doctest-debugging.html">5.2.7 Debugging</A> | |
136 | </div> | |
137 | </div> | |
138 | <hr /> | |
139 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
140 | </DIV> | |
141 | <!--End of Navigation Panel--> | |
142 | <ADDRESS> | |
143 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
144 | </ADDRESS> | |
145 | </BODY> | |
146 | </HTML> |