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`.`pair`.`testing``

module documentation
(source)

Tools for automated testing of `twisted.pair`-based applications.

Class | `MemoryIOSystem` | An in-memory implementation of basic I/O primitives, useful in the context of unit testing as a drop-in replacement for parts of the `os` module.
Class | `Tunnel` | An in-memory implementation of a tun or tap device.
Class | `_FakePort` | A socket-like object which can be used to read UDP datagrams from tunnel-like file descriptors managed by a `MemoryIOSystem`.
Function | `_ethernet` | Construct an ethernet frame.
Function | `_H` | Pack an integer into a network-order two-byte string.
Function | `_ip` | Construct an IP datagram with the given source, destination, and application payload.
Function | `_privileged` | Wrap a `MemoryIOSystem` method with permission-checking logic. The returned function will check `self.permissions` and raise `IOError` with `errno.EPERM` if the function name is not listed as an available permission.
Function | `_udp` | Construct a UDP datagram with the given source, destination, and application payload.
Constant | `_PI_SIZE` | Undocumented
Variable | `_IPv4` | Undocumented

def _ethernet(src, dst, protocol, payload): (source)

Construct an ethernet frame.

Parameters
src:`bytes` | The source ethernet address, encoded.
dst:`bytes` | The destination ethernet address, encoded.
protocol:`int` | The protocol number of the payload of this datagram.
payload:`bytes` | The content of the ethernet frame (such as an IP datagram).
Returns
`bytes` | The full ethernet frame.

def _H(n): (source)

Pack an integer into a network-order two-byte string.

Parameters
n | The integer to pack. Only values that fit into 16 bits are supported.
Returns
`bytes` | The packed representation of the integer.

def _ip(src, dst, payload): (source)

Construct an IP datagram with the given source, destination, and application payload.

Parameters
src:`bytes` | The source IPv4 address as a dotted-quad string.
dst:`bytes` | The destination IPv4 address as a dotted-quad string.
payload:`bytes` | The content of the IP datagram (such as a UDP datagram).
Returns
`bytes` | An IP datagram header and payload.

def _privileged(original): (source)

Wrap a `MemoryIOSystem` method with permission-checking logic. The returned function will check `self.permissions` and raise `IOError` with `errno.EPERM` if the function name is not listed as an available permission.

Parameters
original | The `MemoryIOSystem` instance to wrap.
Returns
A wrapper around `original` that applies permission checks.

def _udp(src, dst, payload): (source)

Construct a UDP datagram with the given source, destination, and application payload.

Parameters
src:`int` | The source port number.
dst:`int` | The destination port number.
payload:`bytes` | The content of the UDP datagram.
Returns
`bytes` | A UDP datagram header and payload.

_PI_SIZE: `int` = (source)

Undocumented

Value

    4

_IPv4: `int` = (source)

Undocumented