Package lxml :: Module doctestcompare
[show private | hide private]
[frames | no frames]

Module lxml.doctestcompare

lxml-based doctest output comparison.

To use this 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.
Classes
LHTMLOutputChecker  
LXMLOutputChecker  
_RestoreChecker  

Function Summary
  install(html)
Install doctestcompare for all future doctests.
  temp_install(html, del_module)
Use this *inside* a doctest to enable this checker for this doctest only.
  _find_doctest_frame()
  norm_whitespace(v)
  strip(v)

Function Details

install(html=False)

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.

temp_install(html=False, del_module=None)

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.

Generated by Epydoc 2.1 on Sat Aug 18 12:44:27 2007 http://epydoc.sf.net