Known subclasses: testtools.content.StackLinesContent, testtools.content.TracebackContent

A MIME-like Content object.

'Content' objects can be serialised to bytes using the iter_bytes method. If the 'Content-Type' is recognised by other code, they are welcome to look for richer contents that mere byte serialisation - for example in memory object graphs etc. However, such code MUST be prepared to receive a generic 'Content' object that has been reconstructed from a byte stream.

Instance Variable content_type The content type of this Content.
Method __init__ Create a ContentType.
Method __eq__ Undocumented
Method as_text Return all of the content as text.
Method iter_bytes Iterate over bytestrings of the serialised content.
Method iter_text Iterate over the text of the serialised content.
Method __repr__ Undocumented
Method _iter_text Worker for iter_text - does the decoding.
content_type =
The content type of this Content.
def __init__(self, content_type, get_bytes):
def __eq__(self, other):
Undocumented
def as_text(self):

Return all of the content as text.

This is only valid where iter_text is. It will load all of the content into memory. Where this is a concern, use iter_text instead.

def iter_bytes(self):
Iterate over bytestrings of the serialised content.
def iter_text(self):

Iterate over the text of the serialised content.

This is only valid for text MIME types, and will use ISO-8859-1 if no charset parameter is present in the MIME type. (This is somewhat arbitrary, but consistent with RFC2617 3.7.1).

RaisesValueErrorIf the content type is not text/*.
def _iter_text(self):
Worker for iter_text - does the decoding.
def __repr__(self):
Undocumented
API Documentation for testtools, generated by pydoctor at 2015-07-01 16:11:28.