Back to index

python3.2  3.2.2
Classes | Functions | Variables
unittest.case Namespace Reference

Classes

class  SkipTest
class  _ExpectedFailure
class  _UnexpectedSuccess
class  _Outcome
class  _AssertRaisesBaseContext
class  _AssertRaisesContext
class  _AssertWarnsContext
class  TestCase
class  FunctionTestCase

Functions

def _id
def skip
def skipIf
def skipUnless
def expectedFailure

Variables

 __unittest = True
tuple DIFF_OMITTED

Detailed Description

Test case implementation

Function Documentation

def unittest.case._id (   obj) [private]

Definition at line 57 of file case.py.

00057 
00058 def _id(obj):
00059     return obj

Definition at line 93 of file case.py.

00093 
00094 def expectedFailure(func):
00095     @functools.wraps(func)
00096     def wrapper(*args, **kwargs):
00097         try:
00098             func(*args, **kwargs)
00099         except Exception:
00100             raise _ExpectedFailure(sys.exc_info())
00101         raise _UnexpectedSuccess
00102     return wrapper
00103 

Here is the call graph for this function:

def unittest.case.skip (   reason)
Unconditionally skip a test.

Definition at line 60 of file case.py.

00060 
00061 def skip(reason):
00062     """
00063     Unconditionally skip a test.
00064     """
00065     def decorator(test_item):
00066         if not (isinstance(test_item, type) and issubclass(test_item, TestCase)):
00067             @functools.wraps(test_item)
00068             def skip_wrapper(*args, **kwargs):
00069                 raise SkipTest(reason)
00070             test_item = skip_wrapper
00071 
00072         test_item.__unittest_skip__ = True
00073         test_item.__unittest_skip_why__ = reason
00074         return test_item
00075     return decorator

Here is the call graph for this function:

Here is the caller graph for this function:

def unittest.case.skipIf (   condition,
  reason 
)
Skip a test if the condition is true.

Definition at line 76 of file case.py.

00076 
00077 def skipIf(condition, reason):
00078     """
00079     Skip a test if the condition is true.
00080     """
00081     if condition:
00082         return skip(reason)
00083     return _id

Here is the call graph for this function:

def unittest.case.skipUnless (   condition,
  reason 
)
Skip a test unless the condition is true.

Definition at line 84 of file case.py.

00084 
00085 def skipUnless(condition, reason):
00086     """
00087     Skip a test unless the condition is true.
00088     """
00089     if not condition:
00090         return skip(reason)
00091     return _id
00092 

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 16 of file case.py.

Initial value:
00001 ('\nDiff is %s characters long. '
00002                  'Set self.maxDiff to None to see it.')

Definition at line 19 of file case.py.