Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Attributes
unittest.suite.BaseTestSuite Class Reference
Inheritance diagram for unittest.suite.BaseTestSuite:
Inheritance graph
[legend]
Collaboration diagram for unittest.suite.BaseTestSuite:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __repr__
def __eq__
def __ne__
def __iter__
def countTestCases
def addTest
def addTests
def run
def __call__
def debug

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Private Attributes

 _tests

Detailed Description

A simple test suite that doesn't provide class or module shared fixtures.

Definition at line 16 of file suite.py.


Constructor & Destructor Documentation

def unittest.suite.BaseTestSuite.__init__ (   self,
  tests = () 
)

Definition at line 19 of file suite.py.

00019 
00020     def __init__(self, tests=()):
00021         self._tests = []
00022         self.addTests(tests)

Here is the caller graph for this function:


Member Function Documentation

def unittest.suite.BaseTestSuite.__call__ (   self,
  args,
  kwds 
)

Definition at line 66 of file suite.py.

00066 
00067     def __call__(self, *args, **kwds):
00068         return self.run(*args, **kwds)

def unittest.suite.BaseTestSuite.__eq__ (   self,
  other 
)

Definition at line 26 of file suite.py.

00026 
00027     def __eq__(self, other):
00028         if not isinstance(other, self.__class__):
00029             return NotImplemented
00030         return list(self) == list(other)

Definition at line 34 of file suite.py.

00034 
00035     def __iter__(self):
00036         return iter(self._tests)

def unittest.suite.BaseTestSuite.__ne__ (   self,
  other 
)

Definition at line 31 of file suite.py.

00031 
00032     def __ne__(self, other):
00033         return not self == other

Definition at line 23 of file suite.py.

00023 
00024     def __repr__(self):
00025         return "<%s tests=%s>" % (util.strclass(self.__class__), list(self))

def unittest.suite.BaseTestSuite.addTest (   self,
  test 
)

Definition at line 43 of file suite.py.

00043 
00044     def addTest(self, test):
00045         # sanity checks
00046         if not hasattr(test, '__call__'):
00047             raise TypeError("{} is not callable".format(repr(test)))
00048         if isinstance(test, type) and issubclass(test,
00049                                                  (case.TestCase, TestSuite)):
00050             raise TypeError("TestCases and TestSuites must be instantiated "
00051                             "before passing them to addTest()")
00052         self._tests.append(test)

Here is the caller graph for this function:

def unittest.suite.BaseTestSuite.addTests (   self,
  tests 
)

Definition at line 53 of file suite.py.

00053 
00054     def addTests(self, tests):
00055         if isinstance(tests, str):
00056             raise TypeError("tests must be an iterable of tests, not a string")
00057         for test in tests:
00058             self.addTest(test)

Here is the call graph for this function:

Definition at line 37 of file suite.py.

00037 
00038     def countTestCases(self):
00039         cases = 0
00040         for test in self:
00041             cases += test.countTestCases()
00042         return cases

Run the tests without collecting errors in a TestResult

Reimplemented in unittest.suite.TestSuite.

Definition at line 69 of file suite.py.

00069 
00070     def debug(self):
00071         """Run the tests without collecting errors in a TestResult"""
00072         for test in self:
00073             test.debug()
00074 

def unittest.suite.BaseTestSuite.run (   self,
  result 
)

Definition at line 59 of file suite.py.

00059 
00060     def run(self, result):
00061         for test in self:
00062             if result.shouldStop:
00063                 break
00064             test(result)
00065         return result

Here is the caller graph for this function:


Member Data Documentation

Definition at line 20 of file suite.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.


The documentation for this class was generated from the following file: