module documentation

lxml-based doctest output comparison. Note: normally, you should just import the `lxml.usedoctest` and `lxml.html.usedoctest` modules from within a doctest, instead of this one:: >>> import lxml.usedoctest # for XML output >>> import lxml.html.usedoctest # for HTML output To use this module directly, you must call ``lxmldoctest.install()``, which will cause doctest to use this in all subsequent calls. This changes the way output is checked and comparisons are made for XML or HTML-like content. XML or HTML content is noticed because the example starts with ``<`` (it's HTML if it starts with ``<html``). You can also use the ``PARSE_HTML`` and ``PARSE_XML`` flags to force parsing. Some rough wildcard-like things are allowed. Whitespace is generally ignored (except in attributes). In text (attributes and text in the body) you can use ``...`` as a wildcard. In an example it also matches any trailing tags in the element, though it does not match leading tags. You may create a tag ``<any>`` or include an ``any`` attribute in the tag. An ``any`` tag matches any tag, while the attribute matches any and all attributes. When a match fails, the reformatted example and gotten text is displayed (indented), and a rough diff-like output is given. Anything marked with ``+`` is in the output but wasn't supposed to be, and similarly ``-`` means its in the example but wasn't in the output. You can disable parsing on one line with ``# doctest:+NOPARSE_MARKUP``

Class LHTMLOutputChecker Undocumented
Class LXMLOutputChecker Undocumented
Function html_fromstring Undocumented
Function install Install doctestcompare for all future doctests.
Function norm_whitespace Undocumented
Function strip Undocumented
Function temp_install Use this *inside* a doctest to enable this checker for this doctest only.
Constant NOPARSE_MARKUP Undocumented
Constant PARSE_HTML Undocumented
Constant PARSE_XML Undocumented
Variable __test__ Undocumented
Class _RestoreChecker Undocumented
Function _find_doctest_frame Undocumented
Constant _IS_PYTHON_3 Undocumented
Variable _html_parser Undocumented
Variable _norm_whitespace_re Undocumented
Variable _repr_re Undocumented
def html_fromstring(html): (source)

Undocumented

def install(html=False): (source)

Install doctestcompare for all future doctests. If html is true, then by default the HTML parser will be used; otherwise the XML parser is used.

def norm_whitespace(v): (source)

Undocumented

def strip(v): (source)

Undocumented

def temp_install(html=False, del_module=None): (source)

Use this *inside* a doctest to enable this checker for this doctest only. If html is true, then by default the HTML parser will be used; otherwise the XML parser is used.

NOPARSE_MARKUP = (source)

Undocumented

Value
doctest.register_optionflag('NOPARSE_MARKUP')
PARSE_HTML = (source)

Undocumented

Value
doctest.register_optionflag('PARSE_HTML')
PARSE_XML = (source)

Undocumented

Value
doctest.register_optionflag('PARSE_XML')
__test__: dict[str, str] = (source)

Undocumented

def _find_doctest_frame(): (source)

Undocumented

_IS_PYTHON_3 = (source)

Undocumented

Value
(sys.version_info[0] >= 3)
_html_parser = (source)

Undocumented

_norm_whitespace_re = (source)

Undocumented

_repr_re = (source)

Undocumented