1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468
|
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><title>unittest</title><body bgcolor="#ffffff">
<p><table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr bgcolor="#7799ee"><td colspan=3 valign=bottom><small><small><br></small></small
><font color="#ffffff" face="helvetica, arial"> <br><big><big><strong> unittest</strong></big></big> (version: 1.20)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"> </font></td></tr>
</table><p><small><tt><br>
Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's<br>
Smalltalk testing framework.<br>
<br>
Further information is available in the bundled documentation, and from<br>
<br>
http://pyunit.sourceforge.net/<br>
<br>
This module contains the core framework classes that form the basis of<br>
specific test cases and suites (<a href="#TestCase">TestCase</a>, <a href="#TestSuite">TestSuite</a> etc.), and also a<br>
text-based utility class for running the tests and reporting the results<br>
(<a href="#TextTestRunner">TextTestRunner</a>).<br>
<br>
Copyright (c) 1999, 2000, 2001 Steve Purcell<br>
This module is free software, and you may redistribute it and/or modify<br>
it under the same terms as Python itself, so long as this copyright message<br>
and disclaimer are retained in their original form.<br>
<br>
IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,<br>
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF<br>
THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH<br>
DAMAGE.<br>
<br>
THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT<br>
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A<br>
PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS,<br>
AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,<br>
SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
</tt></small>
<p><table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr bgcolor="#aa55cc"><td colspan=3 valign=bottom><small><small><br></small></small
><font color="#fffff" face="helvetica, arial"> <big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"> </td><td> </td>
<td><small><small> </small></small
><table width="100%"><tr><td width="25%" valign=top><a href="os.html">os</a><br><a href="string.html">string</a><br></td><td width="25%" valign=top><a href="sys.html">sys</a><br><a href="time.html">time</a><br></td><td width="25%" valign=top><a href="traceback.html">traceback</a><br></td><td width="25%" valign=top></td></tr></table></td></tr></table>
<p><table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr bgcolor="#ee77aa"><td colspan=3 valign=bottom><small><small><br></small></small
><font color="#ffffff" face="helvetica, arial"> <big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"> </td><td> </td>
<td><small><small> </small></small
><dl>
<dt><font face="helvetica, arial"><small><a href="#JUnitTextTestRunner">JUnitTextTestRunner</a>
</small></font></dt><dt><font face="helvetica, arial"><small><a href="#TestCase">TestCase</a>
</small></font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><small><a href="#FunctionTestCase">FunctionTestCase</a>
</small></font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><small><a href="#main">TestProgram</a>
</small></font></dt><dt><font face="helvetica, arial"><small><a href="#TestResult">TestResult</a>
</small></font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><small><a href="#_JUnitTextTestResult">_JUnitTextTestResult</a>
</small></font></dt><dt><font face="helvetica, arial"><small><a href="#_VerboseTextTestResult">_VerboseTextTestResult</a>
</small></font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><small><a href="#TestSuite">TestSuite</a>
</small></font></dt><dt><font face="helvetica, arial"><small><a href="#VerboseTextTestRunner">VerboseTextTestRunner</a>
</small></font></dt><dt><font face="helvetica, arial"><small><a href="#_WritelnDecorator">_WritelnDecorator</a>
</small></font></dt></dl>
<p><table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr bgcolor="#ffc8d8"><td colspan=3 valign=bottom><small><small><br></small></small
><font color="#000000" face="helvetica, arial"> <a name="FunctionTestCase">class <strong>FunctionTestCase</strong></a>(<a href="#TestCase">TestCase</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"> </td>
<td bgcolor="#ffc8d8" colspan=2><small><tt>A test case that wraps a test function.<br>
<br>
This is useful for slipping pre-existing test functions into the<br>
PyUnit framework. Optionally, set-up and tidy-up functions can be<br>
supplied. As with <a href="#TestCase">TestCase</a>, the tidy-up ('tearDown') function will<br>
always be called if the set-up ('setUp') function ran successfully.
<br> </tt></small></td></tr>
<tr><td bgcolor="#ffc8d8"> </td><td> </td>
<td><small><small> </small></small
><dl><dt><a name="FunctionTestCase-__init__"
><strong>__init__</strong>(self, testFunc, setUp<small><font color="#a0a0a0">=None</font></small>, tearDown<small><font color="#a0a0a0">=None</font></small>, description<small><font color="#a0a0a0">=None</font></small>)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="FunctionTestCase-__repr__"
><strong>__repr__</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="FunctionTestCase-__str__"
><strong>__str__</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="FunctionTestCase-id"
><strong>id</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="FunctionTestCase-runTest"
><strong>runTest</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="FunctionTestCase-setUp"
><strong>setUp</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="FunctionTestCase-shortDescription"
><strong>shortDescription</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="FunctionTestCase-tearDown"
><strong>tearDown</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl></td></tr></table>
<p><table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr bgcolor="#ffc8d8"><td colspan=3 valign=bottom><small><small><br></small></small
><font color="#000000" face="helvetica, arial"> <a name="JUnitTextTestRunner">class <strong>JUnitTextTestRunner</strong></a></font></td></tr>
<tr><td bgcolor="#ffc8d8"> </td>
<td bgcolor="#ffc8d8" colspan=2><small><tt>A test runner class that displays results in textual form.<br>
<br>
The display format approximates that of JUnit's 'textui' test runner.<br>
This test runner may be removed in a future version of PyUnit.
<br> </tt></small></td></tr>
<tr><td bgcolor="#ffc8d8"> </td><td> </td>
<td><small><small> </small></small
><dl><dt><a name="JUnitTextTestRunner-__init__"
><strong>__init__</strong>(self, stream<small><font color="#a0a0a0">=<open file '<stderr>', mode 'w' at 804ac88></font></small>)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="JUnitTextTestRunner-run"
><strong>run</strong>(self, test)</a>
<dd><small><tt>Run the given test case or test suite.
</tt></small></dl></td></tr></table>
<p><table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr bgcolor="#ffc8d8"><td colspan=3 valign=bottom><small><small><br></small></small
><font color="#000000" face="helvetica, arial"> <a name="TestCase">class <strong>TestCase</strong></a></font></td></tr>
<tr><td bgcolor="#ffc8d8"> </td>
<td bgcolor="#ffc8d8" colspan=2><small><tt>A class whose instances are single test cases.<br>
<br>
Test authors should subclass <a href="#TestCase">TestCase</a> for their own tests. Construction <br>
and deconstruction of the test's environment ('fixture') can be<br>
implemented by overriding the 'setUp' and 'tearDown' methods respectively.<br>
<br>
By default, the test code itself should be placed in a method named<br>
'runTest'.<br>
<br>
If the fixture may be used for many test cases, create as <br>
many test methods as are needed. When instantiating such a <a href="#TestCase">TestCase</a><br>
subclass, specify in the constructor arguments the name of the test method<br>
that the instance is to execute.
<br> </tt></small></td></tr>
<tr><td bgcolor="#ffc8d8"> </td><td> </td>
<td><small><small> </small></small
><dl><dt><a name="TestCase-__exc_info"
><strong>__exc_info</strong>(self)</a>
<dd><small><tt>Return a version of sys.exc_info() with the traceback frame</tt></small
><dd><small><tt>minimised; usually the top level of the traceback frame is not</tt></small
><dd><small><tt>needed.
</tt></small></dl><dl><dt><a name="TestCase-__call__"
><strong>__call__</strong>(self, result<small><font color="#a0a0a0">=None</font></small>)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestCase-__init__"
><strong>__init__</strong>(self, methodName<small><font color="#a0a0a0">='runTest'</font></small>)</a>
<dd><small><tt>Create an instance of the class that will use the named test</tt></small
><dd><small><tt>method when executed. Raises a ValueError if the instance does</tt></small
><dd><small><tt>not have a method with the specified name.
</tt></small></dl><dl><dt><a name="TestCase-__repr__"
><strong>__repr__</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestCase-__str__"
><strong>__str__</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestCase-assertRaises"
><strong>assertRaises</strong>(self, excClass, callableObj, *args, **kwargs)</a>
<dd><small><tt>Assert that an exception of class excClass is thrown</tt></small
><dd><small><tt>by callableObj when invoked with arguments args and keyword</tt></small
><dd><small><tt>arguments kwargs. If a different type of exception is</tt></small
><dd><small><tt>thrown, it will not be caught, and the test case will be</tt></small
><dd><small><tt>deemed to have suffered an error, exactly as for an</tt></small
><dd><small><tt>unexpected exception.
</tt></small></dl><dl><dt><a name="TestCase-assert_"
><strong>assert_</strong>(self, expr, msg<small><font color="#a0a0a0">=None</font></small>)</a>
<dd><small><tt>Equivalent of built-in 'assert', but is not optimised out when</tt></small
><dd><small><tt>__debug__ is false.
</tt></small></dl><dl><dt><a name="TestCase-countTestCases"
><strong>countTestCases</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestCase-defaultTestResult"
><strong>defaultTestResult</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestCase-fail"
><strong>fail</strong>(self, msg<small><font color="#a0a0a0">=None</font></small>)</a>
<dd><small><tt>Fail immediately, with the given message.
</tt></small></dl><dl><dt><a name="TestCase-failIf"
><strong>failIf</strong>(self, expr, msg<small><font color="#a0a0a0">=None</font></small>)</a>
<dd><small><tt>Fail the test if the expression is true.
</tt></small></dl><dl><dt><a name="TestCase-assert_"
><strong>assert_</strong>(self, expr, msg<small><font color="#a0a0a0">=None</font></small>)</a>
<dd><small><tt>Equivalent of built-in 'assert', but is not optimised out when</tt></small
><dd><small><tt>__debug__ is false.
</tt></small></dl><dl><dt><a name="TestCase-id"
><strong>id</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestCase-run"
><strong>run</strong>(self, result<small><font color="#a0a0a0">=None</font></small>)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestCase-setUp"
><strong>setUp</strong>(self)</a>
<dd><small><tt>Hook method for setting up the test fixture before exercising it.
</tt></small></dl><dl><dt><a name="TestCase-shortDescription"
><strong>shortDescription</strong>(self)</a>
<dd><small><tt>Returns a one-line description of the test, or None if no</tt></small
><dd><small><tt>description has been provided.</tt></small
><dd><small><tt> </tt></small
><dd><small><tt>The default implementation of this method returns the first line of</tt></small
><dd><small><tt>the specified test method's docstring.
</tt></small></dl><dl><dt><a name="TestCase-tearDown"
><strong>tearDown</strong>(self)</a>
<dd><small><tt>Hook method for deconstructing the test fixture after testing it.
</tt></small></dl></td></tr></table>
<p><table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr bgcolor="#ffc8d8"><td colspan=3 valign=bottom><small><small><br></small></small
><font color="#000000" face="helvetica, arial"> <a name="TestProgram">class <strong>TestProgram</strong></a></font></td></tr>
<tr><td bgcolor="#ffc8d8"> </td>
<td bgcolor="#ffc8d8" colspan=2><small><tt>A command-line program that runs a set of tests; this is primarily<br>
for making test modules conveniently executable.
<br> </tt></small></td></tr>
<tr><td bgcolor="#ffc8d8"> </td><td> </td>
<td><small><small> </small></small
><dl><dt><a name="TestProgram-__init__"
><strong>__init__</strong>(self, module<small><font color="#a0a0a0">='__main__'</font></small>, defaultTest<small><font color="#a0a0a0">=None</font></small>, argv<small><font color="#a0a0a0">=None</font></small>, testRunner<small><font color="#a0a0a0">=None</font></small>)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestProgram-createTests"
><strong>createTests</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestProgram-parseArgs"
><strong>parseArgs</strong>(self, argv)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestProgram-runTests"
><strong>runTests</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestProgram-usageExit"
><strong>usageExit</strong>(self, msg<small><font color="#a0a0a0">=None</font></small>)</a>
<dd><small><em>no doc string</em></small></dl></td></tr></table>
<p><table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr bgcolor="#ffc8d8"><td colspan=3 valign=bottom><small><small><br></small></small
><font color="#000000" face="helvetica, arial"> <a name="TestResult">class <strong>TestResult</strong></a></font></td></tr>
<tr><td bgcolor="#ffc8d8"> </td>
<td bgcolor="#ffc8d8" colspan=2><small><tt>Holder for test result information.<br>
<br>
Test results are automatically managed by the <a href="#TestCase">TestCase</a> and <a href="#TestSuite">TestSuite</a><br>
classes, and do not need to be explicitly manipulated by writers of tests.<br>
<br>
Each instance holds the total number of tests run, and collections of<br>
failures and errors that occurred among those test runs. The collections<br>
contain tuples of (testcase, exceptioninfo), where exceptioninfo is a<br>
tuple of values as returned by sys.exc_info().
<br> </tt></small></td></tr>
<tr><td bgcolor="#ffc8d8"> </td><td> </td>
<td><small><small> </small></small
><dl><dt><a name="TestResult-__init__"
><strong>__init__</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestResult-__repr__"
><strong>__repr__</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestResult-addError"
><strong>addError</strong>(self, test, err)</a>
<dd><small><tt>Called when an error has occurred
</tt></small></dl><dl><dt><a name="TestResult-addFailure"
><strong>addFailure</strong>(self, test, err)</a>
<dd><small><tt>Called when a failure has occurred
</tt></small></dl><dl><dt><a name="TestResult-startTest"
><strong>startTest</strong>(self, test)</a>
<dd><small><tt>Called when the given test is about to be run
</tt></small></dl><dl><dt><a name="TestResult-stop"
><strong>stop</strong>(self)</a>
<dd><small><tt>Indicates that the tests should be aborted
</tt></small></dl><dl><dt><a name="TestResult-stopTest"
><strong>stopTest</strong>(self, test)</a>
<dd><small><tt>Called when the given test has been run
</tt></small></dl><dl><dt><a name="TestResult-wasSuccessful"
><strong>wasSuccessful</strong>(self)</a>
<dd><small><tt>Tells whether or not this result was a success
</tt></small></dl></td></tr></table>
<p><table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr bgcolor="#ffc8d8"><td colspan=3 valign=bottom><small><small><br></small></small
><font color="#000000" face="helvetica, arial"> <a name="TestSuite">class <strong>TestSuite</strong></a></font></td></tr>
<tr><td bgcolor="#ffc8d8"> </td>
<td bgcolor="#ffc8d8" colspan=2><small><tt>A test suite is a composite test consisting of a number of TestCases.<br>
<br>
For use, create an instance of <a href="#TestSuite">TestSuite</a>, then add test case instances.<br>
When all tests have been added, the suite can be passed to a test<br>
runner, such as <a href="#TextTestRunner">TextTestRunner</a>. It will run the individual test cases<br>
in the order in which they were added, aggregating the results. When<br>
subclassing, do not forget to call the base class constructor.
<br> </tt></small></td></tr>
<tr><td bgcolor="#ffc8d8"> </td><td> </td>
<td><small><small> </small></small
><dl><dt><a name="TestSuite-__call__"
><strong>__call__</strong>(self, result)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestSuite-__init__"
><strong>__init__</strong>(self, tests<small><font color="#a0a0a0">=()</font></small>)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestSuite-__repr__"
><strong>__repr__</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestSuite-__repr__"
><strong>__repr__</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestSuite-addTest"
><strong>addTest</strong>(self, test)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestSuite-addTests"
><strong>addTests</strong>(self, tests)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestSuite-countTestCases"
><strong>countTestCases</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestSuite-run"
><strong>run</strong>(self, result)</a>
<dd><small><em>no doc string</em></small></dl></td></tr></table>
<p><table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr bgcolor="#ffc8d8"><td colspan=3 valign=bottom><small><small><br></small></small
><font color="#000000" face="helvetica, arial"> <a name="VerboseTextTestRunner">class <strong>VerboseTextTestRunner</strong></a></font></td></tr>
<tr><td bgcolor="#ffc8d8"> </td>
<td bgcolor="#ffc8d8" colspan=2><small><tt>A test runner class that displays results in textual form.<br>
<br>
It prints out the names of tests as they are run, errors as they<br>
occur, and a summary of the results at the end of the test run.
<br> </tt></small></td></tr>
<tr><td bgcolor="#ffc8d8"> </td><td> </td>
<td><small><small> </small></small
><dl><dt><a name="VerboseTextTestRunner-__init__"
><strong>__init__</strong>(self, stream<small><font color="#a0a0a0">=<open file '<stderr>', mode 'w' at 804ac88></font></small>, descriptions<small><font color="#a0a0a0">=1</font></small>)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="VerboseTextTestRunner-run"
><strong>run</strong>(self, test)</a>
<dd><small><tt>Run the given test case or test suite.
</tt></small></dl></td></tr></table>
<p><table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr bgcolor="#ffc8d8"><td colspan=3 valign=bottom><small><small><br></small></small
><font color="#000000" face="helvetica, arial"> <a name="VerboseTextTestRunner">class <strong>VerboseTextTestRunner</strong></a></font></td></tr>
<tr><td bgcolor="#ffc8d8"> </td>
<td bgcolor="#ffc8d8" colspan=2><small><tt>A test runner class that displays results in textual form.<br>
<br>
It prints out the names of tests as they are run, errors as they<br>
occur, and a summary of the results at the end of the test run.
<br> </tt></small></td></tr>
<tr><td bgcolor="#ffc8d8"> </td><td> </td>
<td><small><small> </small></small
><dl><dt><a name="VerboseTextTestRunner-__init__"
><strong>__init__</strong>(self, stream<small><font color="#a0a0a0">=<open file '<stderr>', mode 'w' at 804ac88></font></small>, descriptions<small><font color="#a0a0a0">=1</font></small>)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="VerboseTextTestRunner-run"
><strong>run</strong>(self, test)</a>
<dd><small><tt>Run the given test case or test suite.
</tt></small></dl></td></tr></table>
<p><table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr bgcolor="#ffc8d8"><td colspan=3 valign=bottom><small><small><br></small></small
><font color="#000000" face="helvetica, arial"> <a name="_JUnitTextTestResult">class <strong>_JUnitTextTestResult</strong></a>(<a href="#TestResult">TestResult</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"> </td>
<td bgcolor="#ffc8d8" colspan=2><small><tt>A test result class that can print formatted text results to a stream.<br>
<br>
Used by <a href="#JUnitTextTestRunner">JUnitTextTestRunner</a>.
<br> </tt></small></td></tr>
<tr><td bgcolor="#ffc8d8"> </td><td> </td>
<td><small><small> </small></small
><dl><dt><a name="_JUnitTextTestResult-__init__"
><strong>__init__</strong>(self, stream)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="_JUnitTextTestResult-addError"
><strong>addError</strong>(self, test, error)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="_JUnitTextTestResult-addFailure"
><strong>addFailure</strong>(self, test, error)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="_JUnitTextTestResult-printErrors"
><strong>printErrors</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="_JUnitTextTestResult-printFailures"
><strong>printFailures</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="_JUnitTextTestResult-printHeader"
><strong>printHeader</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="_JUnitTextTestResult-printNumberedErrors"
><strong>printNumberedErrors</strong>(self, errFlavour, errors)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="_JUnitTextTestResult-printResult"
><strong>printResult</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="_JUnitTextTestResult-startTest"
><strong>startTest</strong>(self, test)</a>
<dd><small><em>no doc string</em></small></dl></td></tr></table>
<p><table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr bgcolor="#ffc8d8"><td colspan=3 valign=bottom><small><small><br></small></small
><font color="#000000" face="helvetica, arial"> <a name="_VerboseTextTestResult">class <strong>_VerboseTextTestResult</strong></a>(<a href="#TestResult">TestResult</a>)</font></td></tr>
<tr><td bgcolor="#ffc8d8"> </td>
<td bgcolor="#ffc8d8" colspan=2><small><tt>A test result class that can print formatted text results to a stream.<br>
<br>
Used by <a href="#VerboseTextTestRunner">VerboseTextTestRunner</a>.
<br> </tt></small></td></tr>
<tr><td bgcolor="#ffc8d8"> </td><td> </td>
<td><small><small> </small></small
><dl><dt><a name="_VerboseTextTestResult-__init__"
><strong>__init__</strong>(self, stream, descriptions)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="_VerboseTextTestResult-_printError"
><strong>_printError</strong>(self, flavour, test, err)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="_VerboseTextTestResult-addError"
><strong>addError</strong>(self, test, err)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="_VerboseTextTestResult-addFailure"
><strong>addFailure</strong>(self, test, err)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="_VerboseTextTestResult-startTest"
><strong>startTest</strong>(self, test)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="_VerboseTextTestResult-stopTest"
><strong>stopTest</strong>(self, test)</a>
<dd><small><em>no doc string</em></small></dl></td></tr></table>
<p><table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr bgcolor="#ffc8d8"><td colspan=3 valign=bottom><small><small><br></small></small
><font color="#000000" face="helvetica, arial"> <a name="_WritelnDecorator">class <strong>_WritelnDecorator</strong></a></font></td></tr>
<tr><td bgcolor="#ffc8d8"> </td>
<td bgcolor="#ffc8d8" colspan=2><small><tt>Used to decorate file-like objects with a handy 'writeln' method
<br> </tt></small></td></tr>
<tr><td bgcolor="#ffc8d8"> </td><td> </td>
<td><small><small> </small></small
><dl><dt><a name="_WritelnDecorator-__getattr__"
><strong>__getattr__</strong>(self, attr)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="_WritelnDecorator-__init__"
><strong>__init__</strong>(self, stream)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="_WritelnDecorator-writeln"
><strong>writeln</strong>(self, *args)</a>
<dd><small><em>no doc string</em></small></dl></td></tr></table>
<p><table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr bgcolor="#ffc8d8"><td colspan=3 valign=bottom><small><small><br></small></small
><font color="#000000" face="helvetica, arial"> <a name="TestProgram">class <strong>TestProgram</strong></a></font></td></tr>
<tr><td bgcolor="#ffc8d8"> </td>
<td bgcolor="#ffc8d8" colspan=2><small><tt>A command-line program that runs a set of tests; this is primarily<br>
for making test modules conveniently executable.
<br> </tt></small></td></tr>
<tr><td bgcolor="#ffc8d8"> </td><td> </td>
<td><small><small> </small></small
><dl><dt><a name="TestProgram-__init__"
><strong>__init__</strong>(self, module<small><font color="#a0a0a0">='__main__'</font></small>, defaultTest<small><font color="#a0a0a0">=None</font></small>, argv<small><font color="#a0a0a0">=None</font></small>, testRunner<small><font color="#a0a0a0">=None</font></small>)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestProgram-createTests"
><strong>createTests</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestProgram-parseArgs"
><strong>parseArgs</strong>(self, argv)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestProgram-runTests"
><strong>runTests</strong>(self)</a>
<dd><small><em>no doc string</em></small></dl><dl><dt><a name="TestProgram-usageExit"
><strong>usageExit</strong>(self, msg<small><font color="#a0a0a0">=None</font></small>)</a>
<dd><small><em>no doc string</em></small></dl></td></tr></table></td></tr></table>
<p><table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr bgcolor="#eeaa77"><td colspan=3 valign=bottom><small><small><br></small></small
><font color="#ffffff" face="helvetica, arial"> <big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"> </td><td> </td>
<td><small><small> </small></small
><dl><dt><a name="-createTestInstance"
><strong>createTestInstance</strong>(name, module<small><font color="#a0a0a0">=None</font></small>)</a>
<dd><small><tt>Finds tests by their name, optionally only within the given module.</tt></small
><dd><small><tt> </tt></small
><dd><small><tt>Return the newly-constructed test, ready to run. If the name contains a ':'</tt></small
><dd><small><tt>then the portion of the name after the colon is used to find a specific</tt></small
><dd><small><tt>test case within the test case class named before the colon.</tt></small
><dd><small><tt> </tt></small
><dd><small><tt>Examples:</tt></small
><dd><small><tt> findTest('examples.listtests.suite')</tt></small
><dd><small><tt> -- returns result of calling 'suite'</tt></small
><dd><small><tt> findTest('examples.listtests.ListTestCase:checkAppend')</tt></small
><dd><small><tt> -- returns result of calling ListTestCase('checkAppend')</tt></small
><dd><small><tt> findTest('examples.listtests.ListTestCase:check-')</tt></small
><dd><small><tt> -- returns result of calling <a href="#-makeSuite">makeSuite</a>(ListTestCase, prefix="check")
</tt></small></dl><dl><dt><a name="-getTestCaseNames"
><strong>getTestCaseNames</strong>(testCaseClass, prefix, sortUsing<small><font color="#a0a0a0">=<built-in function cmp></font></small>)</a>
<dd><small><tt>Extracts all the names of functions in the given test case class</tt></small
><dd><small><tt>and its base classes that start with the given prefix. This is used</tt></small
><dd><small><tt>by <a href="#-makeSuite">makeSuite</a>().
</tt></small></dl><dl><dt><a name="-makeSuite"
><strong>makeSuite</strong>(testCaseClass, prefix<small><font color="#a0a0a0">='test'</font></small>, sortUsing<small><font color="#a0a0a0">=<built-in function cmp></font></small>)</a>
<dd><small><tt>Returns a <a href="#TestSuite">TestSuite</a> instance built from all of the test functions</tt></small
><dd><small><tt>in the given test case class whose names begin with the given</tt></small
><dd><small><tt>prefix. The cases are sorted by their function names</tt></small
><dd><small><tt>using the supplied comparison function, which defaults to 'cmp'.
</tt></small></dl></td></tr></table></body></html>
|