<?xml version="1.0" encoding="ascii"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>lxml.doctestcompare</title> <link rel="stylesheet" href="epydoc.css" type="text/css" /> <script type="text/javascript" src="epydoc.js"></script> </head> <body bgcolor="white" text="black" link="blue" vlink="#204080" alink="#204080"> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="lxml-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <!-- Project homepage --> <th class="navbar" align="right" width="100%"> <table border="0" cellpadding="0" cellspacing="0"> <tr><th class="navbar" align="center" ><a class="navbar" target="_top" href="http://codespeak.net/lxml/">lxml API</a></th> </tr></table></th> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0"> <tr valign="top"> <td width="100%"> <span class="breadcrumbs"> <a href="lxml-module.html">Package lxml</a> :: Module doctestcompare </span> </td> <td> <table cellpadding="0" cellspacing="0"> <!-- hide/show private --> <tr><td align="right"><span class="options" >[<a href="frames.html" target="_top">frames</a >] | <a href="lxml.doctestcompare-module.html" target="_top">no frames</a>]</span></td></tr> </table> </td> </tr> </table> <!-- ==================== MODULE DESCRIPTION ==================== --> <h1 class="epydoc">Module doctestcompare</h1><p class="nomargin-top"><span class="codelink"><a href="lxml.doctestcompare-pysrc.html">source code</a></span></p> <p>lxml-based doctest output comparison.</p> <p>Note: normally, you should just import the <a href="lxml.usedoctest-module.html" class="link">lxml.usedoctest</a> and <a href="lxml.html.usedoctest-module.html" class="link">lxml.html.usedoctest</a> modules from within a doctest, instead of this one:</p> <pre class="rst-literal-block"> >>> import lxml.usedoctest # for XML output >>> import lxml.html.usedoctest # for HTML output </pre> <p>To use this module directly, you must call <tt class="rst-docutils literal"><span class="pre">lxmldoctest.install()</span></tt>, which will cause doctest to use this in all subsequent calls.</p> <p>This changes the way output is checked and comparisons are made for XML or HTML-like content.</p> <p>XML or HTML content is noticed because the example starts with <tt class="rst-docutils literal"><span class="pre"><</span></tt> (it's HTML if it starts with <tt class="rst-docutils literal"><span class="pre"><html</span></tt>). You can also use the <tt class="rst-docutils literal"><span class="pre">PARSE_HTML</span></tt> and <tt class="rst-docutils literal"><span class="pre">PARSE_XML</span></tt> flags to force parsing.</p> <p>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 <tt class="rst-docutils literal"><span class="pre">...</span></tt> 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 <tt class="rst-docutils literal"><span class="pre"><any></span></tt> or include an <tt class="rst-docutils literal"><span class="pre">any</span></tt> attribute in the tag. An <tt class="rst-docutils literal"><span class="pre">any</span></tt> tag matches any tag, while the attribute matches any and all attributes.</p> <p>When a match fails, the reformatted example and gotten text is displayed (indented), and a rough diff-like output is given. Anything marked with <tt class="rst-docutils literal"><span class="pre">-</span></tt> is in the output but wasn't supposed to be, and similarly <tt class="rst-docutils literal"><span class="pre">+</span></tt> means its in the example but wasn't in the output.</p> <p>You can disable parsing on one line with <tt class="rst-docutils literal"><span class="pre">#</span> <span class="pre">doctest:+NOPARSE_MARKUP</span></tt></p> <!-- ==================== CLASSES ==================== --> <a name="section-Classes"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Classes</span></td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="lxml.doctestcompare.LXMLOutputChecker-class.html" class="summary-name">LXMLOutputChecker</a> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="lxml.doctestcompare.LHTMLOutputChecker-class.html" class="summary-name">LHTMLOutputChecker</a> </td> </tr> </table> <!-- ==================== FUNCTIONS ==================== --> <a name="section-Functions"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Functions</span></td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="lxml.doctestcompare-module.html#install" class="summary-sig-name">install</a>(<span class="summary-sig-arg">html</span>=<span class="summary-sig-default">False</span>)</span><br /> Install doctestcompare for all future doctests.</td> <td align="right" valign="top"> <span class="codelink"><a href="lxml.doctestcompare-pysrc.html#install">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="lxml.doctestcompare-module.html#temp_install" class="summary-sig-name">temp_install</a>(<span class="summary-sig-arg">html</span>=<span class="summary-sig-default">False</span>, <span class="summary-sig-arg">del_module</span>=<span class="summary-sig-default">None</span>)</span><br /> Use this <em>inside</em> a doctest to enable this checker for this doctest only.</td> <td align="right" valign="top"> <span class="codelink"><a href="lxml.doctestcompare-pysrc.html#temp_install">source code</a></span> </td> </tr> </table> </td> </tr> </table> <!-- ==================== VARIABLES ==================== --> <a name="section-Variables"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Variables</span></td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a name="PARSE_HTML"></a><span class="summary-name">PARSE_HTML</span> = <code title="1024">1024</code> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a name="PARSE_XML"></a><span class="summary-name">PARSE_XML</span> = <code title="2048">2048</code> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a name="NOPARSE_MARKUP"></a><span class="summary-name">NOPARSE_MARKUP</span> = <code title="4096">4096</code> </td> </tr> </table> <!-- ==================== FUNCTION DETAILS ==================== --> <a name="section-FunctionDetails"></a> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Function Details</span></td> </tr> </table> <a name="install"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">install</span>(<span class="sig-arg">html</span>=<span class="sig-default">False</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="lxml.doctestcompare-pysrc.html#install">source code</a></span> </td> </tr></table> <p>Install doctestcompare for all future doctests.</p> <p>If html is true, then by default the HTML parser will be used; otherwise the XML parser is used.</p> <dl class="fields"> </dl> </td></tr></table> </div> <a name="temp_install"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">temp_install</span>(<span class="sig-arg">html</span>=<span class="sig-default">False</span>, <span class="sig-arg">del_module</span>=<span class="sig-default">None</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="lxml.doctestcompare-pysrc.html#temp_install">source code</a></span> </td> </tr></table> <p>Use this <em>inside</em> a doctest to enable this checker for this doctest only.</p> <p>If html is true, then by default the HTML parser will be used; otherwise the XML parser is used.</p> <dl class="fields"> </dl> </td></tr></table> </div> <br /> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="lxml-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <!-- Project homepage --> <th class="navbar" align="right" width="100%"> <table border="0" cellpadding="0" cellspacing="0"> <tr><th class="navbar" align="center" ><a class="navbar" target="_top" href="http://codespeak.net/lxml/">lxml API</a></th> </tr></table></th> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="100%%"> <tr> <td align="left" class="footer"> Generated by Epydoc 3.0 on Fri Dec 12 22:40:29 2008 </td> <td align="right" class="footer"> <a target="mainFrame" href="http://epydoc.sourceforge.net" >http://epydoc.sourceforge.net</a> </td> </tr> </table> <script type="text/javascript"> <!-- // Private objects are initially displayed (because if // javascript is turned off then we want them to be // visible); but by default, we want to hide them. So hide // them unless we have a cookie that says to show them. checkCookie(); // --> </script> </body> </html>