Home | Trees | Index | Help |
|
---|
Module unittest :: Class TestCase |
|
object
--+
|
TestCase
ErrorTestCase
,
HelperTestCase
,
IOTestCaseBase
,
UnicodeTestCase
A class whose instances are single test cases.
By default, the test code itself should be placed in a method named 'runTest'.
If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.
Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test's environment ('fixture') can be implemented by overriding the 'setUp' and 'tearDown' methods respectively.
If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.Method Summary | |
---|---|
Create an instance of the class that will use the named test method when executed. | |
__call__(self,
*args,
**kwds)
| |
__repr__(self)
| |
__str__(self)
| |
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. | |
countTestCases(self)
| |
Run the test without collecting errors in a TestResult | |
defaultTestResult(self)
| |
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. | |
id(self)
| |
run(self,
result)
| |
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 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 |
Class Variable Summary | |
---|---|
type |
failureException = exceptions.AssertionError |
Method Details |
---|
__init__(self,
methodName='runTest')
Create an instance of the class that will use the named test method
when executed. Raises a ValueError if the instance does not have a
method with the specified name.
|
assert_(self, expr, msg=None)Fail the test unless the expression is true. |
assertAlmostEqual(self, 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(self, 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(self, first, second, msg=None)Fail if the two objects are unequal as determined by the '==' operator. |
assertEquals(self, first, second, msg=None)Fail if the two objects are unequal as determined by the '==' operator. |
assertFalse(self, expr, msg=None)Fail the test if the expression is true. |
assertNotAlmostEqual(self, 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(self, 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(self, first, second, msg=None)Fail if the two objects are equal as determined by the '==' operator. |
assertNotEquals(self, first, second, msg=None)Fail if the two objects are equal as determined by the '==' operator. |
assertRaises(self, 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(self, expr, msg=None)Fail the test unless the expression is true. |
debug(self)Run the test without collecting errors in a TestResult |
fail(self, msg=None)Fail immediately, with the given message. |
failIf(self, expr, msg=None)Fail the test if the expression is true. |
failIfAlmostEqual(self, 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(self, first, second, msg=None)Fail if the two objects are equal as determined by the '==' operator. |
failUnless(self, expr, msg=None)Fail the test unless the expression is true. |
failUnlessAlmostEqual(self, 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(self, first, second, msg=None)Fail if the two objects are unequal as determined by the '==' operator. |
failUnlessRaises(self, 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. |
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. |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Sat Aug 18 12:44:27 2007 | http://epydoc.sf.net |