class documentation

Tests for utilities that access data from the RawHeaders internal representation.

Method getValues Look up the values for the given header name from the given raw headers.
Method headerNormalize Test hook for the normalization of header text values, which is a behavior Twisted has changed after version 18.9.0.
Method test_getBytesName getValues returns an iterable of bytes values for the given bytes header name.
Method test_getInvalidNameType getValues raises TypeError when the given header name is of an unknown type.
Method test_getTextName getValues returns an iterable of str values for the given str header name.
Method test_getTextNameBinaryValues getValues returns an iterable of str values for the given str header name.
@abstractmethod
def getValues(self, rawHeaders, name): (source)

Look up the values for the given header name from the given raw headers.

This is called by the other tests in this mix-in class to allow test cases that use it to specify how to perform this look-up in the implementation being tested.

Parameters
rawHeaders:RawHeadersUndocumented
name:AnyStrUndocumented
Returns
Iterable[AnyStr]Undocumented
def headerNormalize(self, value): (source)

Test hook for the normalization of header text values, which is a behavior Twisted has changed after version 18.9.0.

Parameters
value:strUndocumented
Returns
strUndocumented
def test_getBytesName(self): (source)

getValues returns an iterable of bytes values for the given bytes header name.

def test_getInvalidNameType(self): (source)

getValues raises TypeError when the given header name is of an unknown type.

@given(iterables(tuples(ascii_text(min_size=1), latin1_text())))
def test_getTextName(self, textPairs): (source)

getValues returns an iterable of str values for the given str header name.

This test only inserts Latin1 text into the header values, which is valid data.

Parameters
textPairs:Iterable[Tuple[str, str]]Undocumented
@given(iterables(tuples(ascii_text(min_size=1), binary())))
def test_getTextNameBinaryValues(self, pairs): (source)

getValues returns an iterable of str values for the given str header name.

This test only inserts binary data into the header values, which includes invalid data if you are a sane person, but arguably technically valid if you read the spec because the spec is unclear about header encodings, so we made sure that works also, if only sort of.

Parameters
pairs:Iterable[Tuple[str, bytes]]Undocumented