l.s.t.doctestcodec : module documentation

Part of lp.services.testing

Codecs to convert Unicode strings to more human readable representations.

Defines the 'doctest' encoding. This is ASCII, with Unicode characters represented using the standard Python N{YEN SIGN} syntax.

Function doctest_unicode_error_handler Codec error handler for doctests, registered as 'doctest'.
Function doctest_unicode_encode Encoder to convert Unicode to 'doctest' format.
Function doctest_unicode_decode Decoder to convert from 'doctest' encoding to Unicode.
Function doctest_unicode_search Codec search function for the 'doctest' codec.
def doctest_unicode_error_handler(error):

Codec error handler for doctests, registered as 'doctest'.

>>> unicode_string = u"I \N{BLACK HEART SUIT}\N{YEN SIGN}!"
>>> print unicode_string.encode('ascii', 'doctest')
I \N{BLACK HEART SUIT}\N{YEN SIGN}!
def doctest_unicode_encode(input, errors='strict'):

Encoder to convert Unicode to 'doctest' format.

>>> unicode_string = u"I \N{BLACK HEART SUIT}\N{YEN SIGN}!"
>>> print unicode_string.encode('doctest')
I \N{BLACK HEART SUIT}\N{YEN SIGN}!
def doctest_unicode_decode(input, errors='strict'):

Decoder to convert from 'doctest' encoding to Unicode.

>>> unicode_string = u"I \N{BLACK HEART SUIT}\N{YEN SIGN}!"
>>> doctest_string = unicode_string.encode('doctest')
>>> print doctest_string
I \N{BLACK HEART SUIT}\N{YEN SIGN}!
>>> roundtrip_string = doctest_string.decode('doctest')
>>> roundtrip_string == unicode_string
True
def doctest_unicode_search(encoding_name):
Codec search function for the 'doctest' codec.
API Documentation for Launchpad, generated by pydoctor at 2018-02-22 00:00:13.