Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`trial`.`_synctest`.`_AssertRaisesContext``

class documentation

`class _AssertRaisesContext: (source)`

View In Hierarchy

A helper for implementing `assertRaises`. This is a context manager and a helper method to support the non-context manager version of `assertRaises`.

Method | `__enter__` | Undocumented
Method | `__exit__` | Check exit exception against expected exception.
Method | `__init__` | No summary
Instance Variable | `exception` | The exception which was raised by the function being tested (if it raised one).
Method | `_handle` | Call the given object using this object as a context manager.
Instance Variable | `_expected` | See `expected` parameter of `__init__`
Instance Variable | `_expectedName` | A short string describing the expected exception (usually the name of the exception class).
Instance Variable | `_returnValue` | The value returned by the callable being tested (only when not being used as a context manager).
Instance Variable | `_testCase` | See `testCase` parameter of `__init__`

def __enter__(self): (source)

Undocumented

def __exit__(self, exceptionType, exceptionValue, traceback): (source)

Check exit exception against expected exception.

def __init__(self, testCase, expected): (source)

Parameters
testCase | The `TestCase` instance which is used to raise a test-failing exception when that is necessary.
expected | The exception type expected to be raised.

exception = (source)

The exception which was raised by the function being tested (if it raised one).

def _handle(self, obj): (source)

Call the given object using this object as a context manager.

Parameters
obj:`object` | The object to call and which is expected to raise some exception.
Returns
`BaseException` | Whatever exception is raised by `obj()`.

_expected = (source)

See `expected` parameter of `__init__`

_expectedName = (source)

A short string describing the expected exception (usually the name of the exception class).

_returnValue = (source)

The value returned by the callable being tested (only when not being used as a context manager).

_testCase = (source)

See `testCase` parameter of `__init__`