Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes Class Reference
Inheritance diagram for
Inheritance graph
Collaboration diagram for
Collaboration graph

List of all members.

Public Member Functions

def __enter__
def __exit__

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Detailed Description

A context manager used to implement TestCase.assertRaises* methods.

Definition at line 122 of file

Member Function Documentation

Definition at line 125 of file

00126     def __enter__(self):
00127         return self

def (   self,

Definition at line 128 of file

00129     def __exit__(self, exc_type, exc_value, tb):
00130         if exc_type is None:
00131             try:
00132                 exc_name = self.expected.__name__
00133             except AttributeError:
00134                 exc_name = str(self.expected)
00135             if self.obj_name:
00136                 raise self.failureException("{0} not raised by {1}"
00137                     .format(exc_name, self.obj_name))
00138             else:
00139                 raise self.failureException("{0} not raised"
00140                     .format(exc_name))
00141         if not issubclass(exc_type, self.expected):
00142             # let unexpected exceptions pass through
00143             return False
00144         # store exception, without traceback, for later retrieval
00145         self.exception = exc_value.with_traceback(None)
00146         if self.expected_regex is None:
00147             return True
00149         expected_regex = self.expected_regex
00150         if not
00151             raise self.failureException('"%s" does not match "%s"' %
00152                      (expected_regex.pattern, str(exc_value)))
00153         return True

Member Data Documentation

Definition at line 144 of file

Definition at line 108 of file

Definition at line 119 of file

Definition at line 109 of file

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Definition at line 112 of file

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