Trees | Index | Help |
|
---|
Package zope :: Package testing :: Module doctest :: Class DocTestCase |
|
object
--+ |TestCase
--+ | DocTestCase
DocFileCase
Method Summary | |
---|---|
__init__(self,
test,
optionflags,
setUp,
tearDown,
checker)
| |
__repr__(self)
| |
__str__(self)
| |
countTestCases(self)
| |
Run the test case without results and without catching exceptions | |
format_failure(self,
err)
| |
id(self)
| |
runTest(self)
| |
Hook method for setting up the test fixture before exercising it. | |
Returns a one-line description of the test, or None if no description has been provided. | |
Hook method for deconstructing the test fixture after testing it. | |
Inherited from TestCase | |
| |
Fail the test unless the expression is true. | |
Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. | |
Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. | |
Fail if the two objects are unequal as determined by the '==' operator. | |
Fail if the two objects are unequal as determined by the '==' operator. | |
Fail the test if the expression is true. | |
Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. | |
Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. | |
Fail if the two objects are equal as determined by the '==' operator. | |
Fail if the two objects are equal as determined by the '==' operator. | |
Fail unless an exception of class excClass is thrown by callableObj when invoked with arguments args and keyword arguments kwargs. | |
Fail the test unless the expression is true. | |
| |
Fail immediately, with the given message. | |
Fail the test if the expression is true. | |
Fail if the two objects are equal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. | |
Fail if the two objects are equal as determined by the '==' operator. | |
Fail the test unless the expression is true. | |
Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. | |
Fail if the two objects are unequal as determined by the '==' operator. | |
Fail unless an exception of class excClass is thrown by callableObj when invoked with arguments args and keyword arguments kwargs. | |
| |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value |
Method Details |
---|
debug(self)Run the test case without results and without catching exceptions The unit test framework includes a debug method on test cases and test suites to support post-mortem debugging. The test code is run in such a way that errors are not caught. This way a caller can catch the errors and initiate post-mortem debugging. The DocTestCase provides a debug method that raises UnexpectedException errors if there is an unexepcted exception: >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42', ... {}, 'foo', 'foo.py', 0) >>> case = DocTestCase(test) >>> try: ... case.debug() ... except UnexpectedException, failure: ... pass The UnexpectedException contains the test, the example, and the original exception: >>> failure.test is test True>>> failure.example.want '42\n'>>> exc_info = failure.exc_info >>> raise exc_info[0], exc_info[1], exc_info[2] Traceback (most recent call last): ... KeyError If the output doesn't match, then a DocTestFailure is raised: >>> test = DocTestParser().get_doctest(''' ... >>> x = 1 ... >>> x ... 2 ... ''', {}, 'foo', 'foo.py', 0) >>> case = DocTestCase(test)>>> try: ... case.debug() ... except DocTestFailure, failure: ... pass DocTestFailure objects provide access to the test: >>> failure.test is test True As well as to the example: >>> failure.example.want '2\n' and the actual output: >>> failure.got '1\n'
|
setUp(self)Hook method for setting up the test fixture before exercising it.
|
shortDescription(self)Returns a one-line description of the test, or None if no description has been provided. The default implementation of this method returns the first line of the specified test method's docstring.
|
tearDown(self)Hook method for deconstructing the test fixture after testing it.
|
Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Fri Jun 24 12:01:25 2005 | http://epydoc.sf.net |