There are no implemented interfaces.
failureException
(type: classobj
)
<class zope.testing.doctest.DocTestFailureException at 0x41700ecc>
assertAlmostEqual(first, second, places=7, msg=None)
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.
Note that decimal places (from zero) are usually not the same as significant digits (measured from the most signficant digit).
assertAlmostEquals(first, second, places=7, msg=None)
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.
Note that decimal places (from zero) are usually not the same as significant digits (measured from the most signficant digit).
assertEqual(first, second, msg=None)
Fail if the two objects are unequal as determined by the ==
operator.
assertEquals(first, second, msg=None)
Fail if the two objects are unequal as determined by the ==
operator.
assertFalse(expr, msg=None)
Fail the test if the expression is true.
assertNotAlmostEqual(first, second, places=7, msg=None)
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.
Note that decimal places (from zero) are usually not the same as significant digits (measured from the most signficant digit).
assertNotAlmostEquals(first, second, places=7, msg=None)
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.
Note that decimal places (from zero) are usually not the same as significant digits (measured from the most signficant digit).
assertNotEqual(first, second, msg=None)
Fail if the two objects are equal as determined by the ==
operator.
assertNotEquals(first, second, msg=None)
Fail if the two objects are equal as determined by the ==
operator.
assertRaises(excClass, callableObj, *args, **kwargs)
Fail unless an exception of class excClass is thrown by callableObj when invoked with arguments args and keyword arguments kwargs. If a different type of exception is thrown, it will not be caught, and the test case will be deemed to have suffered an error, exactly as for an unexpected exception.
assertTrue(expr, msg=None)
Fail the test unless the expression is true.
assert_(expr, msg=None)
Fail the test unless the expression is true.
countTestCases()
debug()
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'
defaultTestResult()
fail(msg=None)
Fail immediately, with the given message.
failIf(expr, msg=None)
Fail the test if the expression is true.
failIfAlmostEqual(first, second, places=7, msg=None)
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.
Note that decimal places (from zero) are usually not the same as significant digits (measured from the most signficant digit).
failIfEqual(first, second, msg=None)
Fail if the two objects are equal as determined by the ==
operator.
failUnless(expr, msg=None)
Fail the test unless the expression is true.
failUnlessAlmostEqual(first, second, places=7, msg=None)
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.
Note that decimal places (from zero) are usually not the same as significant digits (measured from the most signficant digit).
failUnlessEqual(first, second, msg=None)
Fail if the two objects are unequal as determined by the ==
operator.
failUnlessRaises(excClass, callableObj, *args, **kwargs)
Fail unless an exception of class excClass is thrown by callableObj when invoked with arguments args and keyword arguments kwargs. If a different type of exception is thrown, it will not be caught, and the test case will be deemed to have suffered an error, exactly as for an unexpected exception.
format_failure(err)
id()
run(result=None)
runTest()
setUp()
shortDescription()
tearDown()
There are no known subclasses.