Sophie

Sophie

distrib > CentOS > 5 > i386 > by-pkgid > 90dba77ca23efa667b541b5c0dd77497 > files > 256

python-lxml-2.0.11-2.el5.i386.rpm

<?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.tests.test_css</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>&nbsp;&nbsp;&nbsp;<a
        href="lxml-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</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&nbsp;lxml</a> ::
        <a href="lxml.tests-module.html">Package&nbsp;tests</a> ::
        Module&nbsp;test_css
      </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
            >]&nbsp;|&nbsp;<a href="lxml.tests.test_css-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="lxml.tests.test_css-module.html">Module lxml.tests.test_css</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">unittest</tt><tt class="py-op">,</tt> <tt class="py-name">sys</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-0" class="py-name" targets="Package lxml=lxml-module.html"><a title="lxml" class="py-name" href="#" onclick="return doclink('link-0', 'lxml', 'link-0');">lxml</a></tt><tt class="py-op">.</tt><tt id="link-1" class="py-name" targets="Package lxml.tests=lxml.tests-module.html"><a title="lxml.tests" class="py-name" href="#" onclick="return doclink('link-1', 'tests', 'link-1');">tests</a></tt><tt class="py-op">.</tt><tt id="link-2" class="py-name" targets="Module lxml.tests.common_imports=lxml.tests.common_imports-module.html"><a title="lxml.tests.common_imports" class="py-name" href="#" onclick="return doclink('link-2', 'common_imports', 'link-2');">common_imports</a></tt> <tt class="py-keyword">import</tt> <tt class="py-name">doctest</tt><tt class="py-op">,</tt> <tt id="link-3" class="py-name" targets="Class lxml.tests.common_imports.HelperTestCase=lxml.tests.common_imports.HelperTestCase-class.html"><a title="lxml.tests.common_imports.HelperTestCase" class="py-name" href="#" onclick="return doclink('link-3', 'HelperTestCase', 'link-3');">HelperTestCase</a></tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-4" class="py-name"><a title="lxml" class="py-name" href="#" onclick="return doclink('link-4', 'lxml', 'link-0');">lxml</a></tt> <tt class="py-keyword">import</tt> <tt id="link-5" class="py-name" targets="Package lxml.html=lxml.html-module.html"><a title="lxml.html" class="py-name" href="#" onclick="return doclink('link-5', 'html', 'link-5');">html</a></tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-6" class="py-name"><a title="lxml" class="py-name" href="#" onclick="return doclink('link-6', 'lxml', 'link-0');">lxml</a></tt> <tt class="py-keyword">import</tt> <tt id="link-7" class="py-name" targets="Module lxml.cssselect=lxml.cssselect-module.html"><a title="lxml.cssselect" class="py-name" href="#" onclick="return doclink('link-7', 'cssselect', 'link-7');">cssselect</a></tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">os</tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt id="link-8" class="py-name" targets="Variable lxml.tests.test_css.doc_fn=lxml.tests.test_css-module.html#doc_fn"><a title="lxml.tests.test_css.doc_fn" class="py-name" href="#" onclick="return doclink('link-8', 'doc_fn', 'link-8');">doc_fn</a></tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-9" class="py-name" targets="Variable lxml.etree.XPath.path=lxml.etree.XPath-class.html#path"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-9', 'path', 'link-9');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-10" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-10', 'path', 'link-9');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">dirname</tt><tt class="py-op">(</tt><tt class="py-name">__file__</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line">                      <tt class="py-string">'css_shakespear.html'</tt><tt class="py-op">)</tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"><tt class="py-comment"># Data borrowed from http://mootools.net/slickspeed/</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt class="py-comment"></tt> </tt>
<a name="CSSTestCase"></a><div id="CSSTestCase-def"><a name="L12"></a><tt class="py-lineno"> 12</tt> <a class="py-toggle" href="#" id="CSSTestCase-toggle" onclick="return toggle('CSSTestCase');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lxml.tests.test_css.CSSTestCase-class.html">CSSTestCase</a><tt class="py-op">(</tt><tt class="py-base-class">HelperTestCase</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CSSTestCase-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="CSSTestCase-expanded"><a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line">     </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line">    <tt id="link-11" class="py-name" targets="Variable lxml.tests.test_css.CSSTestCase.selectors=lxml.tests.test_css.CSSTestCase-class.html#selectors"><a title="lxml.tests.test_css.CSSTestCase.selectors" class="py-name" href="#" onclick="return doclink('link-11', 'selectors', 'link-11');">selectors</a></tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line">        <tt class="py-comment">## Changed from original; probably because I'm only searching the body</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line">        <tt class="py-comment">#('*', 252),</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'*'</tt><tt class="py-op">,</tt> <tt class="py-number">246</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div:only-child'</tt><tt class="py-op">,</tt> <tt class="py-number">22</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-comment"># ?</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line">        <tt class="py-comment">## Changed from original, because the original doesn't make sense.</tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line">        <tt class="py-comment">## There really aren't that many occurrances of 'celia'</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line">        <tt class="py-comment">#('div:contains(CELIA)', 243),</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div:contains(CELIA)'</tt><tt class="py-op">,</tt> <tt class="py-number">30</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div:nth-child(even)'</tt><tt class="py-op">,</tt> <tt class="py-number">106</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div:nth-child(2n)'</tt><tt class="py-op">,</tt> <tt class="py-number">106</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div:nth-child(odd)'</tt><tt class="py-op">,</tt> <tt class="py-number">137</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div:nth-child(2n+1)'</tt><tt class="py-op">,</tt> <tt class="py-number">137</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div:nth-child(n)'</tt><tt class="py-op">,</tt> <tt class="py-number">243</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div:last-child'</tt><tt class="py-op">,</tt> <tt class="py-number">53</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div:first-child'</tt><tt class="py-op">,</tt> <tt class="py-number">51</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div &gt; div'</tt><tt class="py-op">,</tt> <tt class="py-number">242</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div + div'</tt><tt class="py-op">,</tt> <tt class="py-number">190</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div ~ div'</tt><tt class="py-op">,</tt> <tt class="py-number">190</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'body'</tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'body div'</tt><tt class="py-op">,</tt> <tt class="py-number">243</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div'</tt><tt class="py-op">,</tt> <tt class="py-number">243</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div div'</tt><tt class="py-op">,</tt> <tt class="py-number">242</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div div div'</tt><tt class="py-op">,</tt> <tt class="py-number">241</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div, div, div'</tt><tt class="py-op">,</tt> <tt class="py-number">243</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div, a, span'</tt><tt class="py-op">,</tt> <tt class="py-number">243</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'.dialog'</tt><tt class="py-op">,</tt> <tt class="py-number">51</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div.dialog'</tt><tt class="py-op">,</tt> <tt class="py-number">51</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div .dialog'</tt><tt class="py-op">,</tt> <tt class="py-number">51</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div.character, div.dialog'</tt><tt class="py-op">,</tt> <tt class="py-number">99</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div.direction.dialog'</tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div.dialog.direction'</tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div.dialog.scene'</tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div.scene.scene'</tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div.scene .scene'</tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div.direction .dialog '</tt><tt class="py-op">,</tt> <tt class="py-number">0</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div .dialog .direction'</tt><tt class="py-op">,</tt> <tt class="py-number">4</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div.dialog .dialog .direction'</tt><tt class="py-op">,</tt> <tt class="py-number">4</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'#speech5'</tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div#speech5'</tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div #speech5'</tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div.scene div.dialog'</tt><tt class="py-op">,</tt> <tt class="py-number">49</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div#scene1 div.dialog div'</tt><tt class="py-op">,</tt> <tt class="py-number">142</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'#scene1 #speech1'</tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div[class]'</tt><tt class="py-op">,</tt> <tt class="py-number">103</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div[class=dialog]'</tt><tt class="py-op">,</tt> <tt class="py-number">50</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div[class^=dia]'</tt><tt class="py-op">,</tt> <tt class="py-number">51</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div[class$=log]'</tt><tt class="py-op">,</tt> <tt class="py-number">50</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div[class*=sce]'</tt><tt class="py-op">,</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div[class|=dialog]'</tt><tt class="py-op">,</tt> <tt class="py-number">50</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-comment"># ? Seems right</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div[class!=madeup]'</tt><tt class="py-op">,</tt> <tt class="py-number">243</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-comment"># ? Seems right</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line">        <tt class="py-op">(</tt><tt class="py-string">'div[class~=dialog]'</tt><tt class="py-op">,</tt> <tt class="py-number">51</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-comment"># ? Seems right</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line">        <tt class="py-op">]</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line"> </tt>
<a name="CSSTestCase.__init__"></a><div id="CSSTestCase.__init__-def"><a name="L68"></a><tt class="py-lineno"> 68</tt> <a class="py-toggle" href="#" id="CSSTestCase.__init__-toggle" onclick="return toggle('CSSTestCase.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_css.CSSTestCase-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">index</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CSSTestCase.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CSSTestCase.__init__-expanded"><a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">index</tt> <tt class="py-op">=</tt> <tt class="py-name">index</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt>  <tt class="py-line">        <tt class="py-name">super</tt><tt class="py-op">(</tt><tt id="link-12" class="py-name"><a title="lxml.tests.common_imports.HelperTestCase" class="py-name" href="#" onclick="return doclink('link-12', 'HelperTestCase', 'link-3');">HelperTestCase</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-13" class="py-name" targets="Method lxml.builder.ElementMaker.__init__()=lxml.builder.ElementMaker-class.html#__init__,Method lxml.cssselect.CSSSelector.__init__()=lxml.cssselect.CSSSelector-class.html#__init__,Method lxml.etree.AncestorsIterator.__init__()=lxml.etree.AncestorsIterator-class.html#__init__,Method lxml.etree.AttributeBasedElementClassLookup.__init__()=lxml.etree.AttributeBasedElementClassLookup-class.html#__init__,Method lxml.etree.DTD.__init__()=lxml.etree.DTD-class.html#__init__,Method lxml.etree.DocInfo.__init__()=lxml.etree.DocInfo-class.html#__init__,Method lxml.etree.ETCompatXMLParser.__init__()=lxml.etree.ETCompatXMLParser-class.html#__init__,Method lxml.etree.ETXPath.__init__()=lxml.etree.ETXPath-class.html#__init__,Method lxml.etree.ElementChildIterator.__init__()=lxml.etree.ElementChildIterator-class.html#__init__,Method lxml.etree.ElementDefaultClassLookup.__init__()=lxml.etree.ElementDefaultClassLookup-class.html#__init__,Method lxml.etree.ElementDepthFirstIterator.__init__()=lxml.etree.ElementDepthFirstIterator-class.html#__init__,Method lxml.etree.ElementNamespaceClassLookup.__init__()=lxml.etree.ElementNamespaceClassLookup-class.html#__init__,Method lxml.etree.ElementTextIterator.__init__()=lxml.etree.ElementTextIterator-class.html#__init__,Method lxml.etree.FallbackElementClassLookup.__init__()=lxml.etree.FallbackElementClassLookup-class.html#__init__,Method lxml.etree.HTMLParser.__init__()=lxml.etree.HTMLParser-class.html#__init__,Method lxml.etree.LxmlError.__init__()=lxml.etree.LxmlError-class.html#__init__,Method lxml.etree.PyErrorLog.__init__()=lxml.etree.PyErrorLog-class.html#__init__,Method lxml.etree.QName.__init__()=lxml.etree.QName-class.html#__init__,Method lxml.etree.RelaxNG.__init__()=lxml.etree.RelaxNG-class.html#__init__,Method lxml.etree.Schematron.__init__()=lxml.etree.Schematron-class.html#__init__,Method lxml.etree.SiblingsIterator.__init__()=lxml.etree.SiblingsIterator-class.html#__init__,Method lxml.etree.TreeBuilder.__init__()=lxml.etree.TreeBuilder-class.html#__init__,Method lxml.etree.XInclude.__init__()=lxml.etree.XInclude-class.html#__init__,Method lxml.etree.XMLParser.__init__()=lxml.etree.XMLParser-class.html#__init__,Method lxml.etree.XMLSchema.__init__()=lxml.etree.XMLSchema-class.html#__init__,Method lxml.etree.XMLSyntaxError.__init__()=lxml.etree.XMLSyntaxError-class.html#__init__,Method lxml.etree.XPath.__init__()=lxml.etree.XPath-class.html#__init__,Method lxml.etree.XPathDocumentEvaluator.__init__()=lxml.etree.XPathDocumentEvaluator-class.html#__init__,Method lxml.etree.XPathElementEvaluator.__init__()=lxml.etree.XPathElementEvaluator-class.html#__init__,Method lxml.etree.XSLT.__init__()=lxml.etree.XSLT-class.html#__init__,Method lxml.etree.XSLTAccessControl.__init__()=lxml.etree.XSLTAccessControl-class.html#__init__,Method lxml.etree.iterparse.__init__()=lxml.etree.iterparse-class.html#__init__,Method lxml.etree.iterwalk.__init__()=lxml.etree.iterwalk-class.html#__init__,Method lxml.html.clean.Cleaner.__init__()=lxml.html.clean.Cleaner-class.html#__init__,Method lxml.html.formfill.DefaultErrorCreator.__init__()=lxml.html.formfill.DefaultErrorCreator-class.html#__init__,Method lxml.objectify.ElementMaker.__init__()=lxml.objectify.ElementMaker-class.html#__init__,Method lxml.objectify.ObjectPath.__init__()=lxml.objectify.ObjectPath-class.html#__init__,Method lxml.objectify.ObjectifyElementClassLookup.__init__()=lxml.objectify.ObjectifyElementClassLookup-class.html#__init__,Method lxml.objectify.PyType.__init__()=lxml.objectify.PyType-class.html#__init__,Method lxml.sax.ElementTreeContentHandler.__init__()=lxml.sax.ElementTreeContentHandler-class.html#__init__,Method lxml.sax.ElementTreeProducer.__init__()=lxml.sax.ElementTreeProducer-class.html#__init__,Method lxml.tests.common_imports.LargeFileLike.__init__()=lxml.tests.common_imports.LargeFileLike-class.html#__init__,Method lxml.tests.common_imports.SillyFileLike.__init__()=lxml.tests.common_imports.SillyFileLike-class.html#__init__,Method lxml.tests.test_css.CSSTestCase.__init__()=lxml.tests.test_css.CSSTestCase-class.html#__init__"><a title="lxml.builder.ElementMaker.__init__
lxml.cssselect.CSSSelector.__init__
lxml.etree.AncestorsIterator.__init__
lxml.etree.AttributeBasedElementClassLookup.__init__
lxml.etree.DTD.__init__
lxml.etree.DocInfo.__init__
lxml.etree.ETCompatXMLParser.__init__
lxml.etree.ETXPath.__init__
lxml.etree.ElementChildIterator.__init__
lxml.etree.ElementDefaultClassLookup.__init__
lxml.etree.ElementDepthFirstIterator.__init__
lxml.etree.ElementNamespaceClassLookup.__init__
lxml.etree.ElementTextIterator.__init__
lxml.etree.FallbackElementClassLookup.__init__
lxml.etree.HTMLParser.__init__
lxml.etree.LxmlError.__init__
lxml.etree.PyErrorLog.__init__
lxml.etree.QName.__init__
lxml.etree.RelaxNG.__init__
lxml.etree.Schematron.__init__
lxml.etree.SiblingsIterator.__init__
lxml.etree.TreeBuilder.__init__
lxml.etree.XInclude.__init__
lxml.etree.XMLParser.__init__
lxml.etree.XMLSchema.__init__
lxml.etree.XMLSyntaxError.__init__
lxml.etree.XPath.__init__
lxml.etree.XPathDocumentEvaluator.__init__
lxml.etree.XPathElementEvaluator.__init__
lxml.etree.XSLT.__init__
lxml.etree.XSLTAccessControl.__init__
lxml.etree.iterparse.__init__
lxml.etree.iterwalk.__init__
lxml.html.clean.Cleaner.__init__
lxml.html.formfill.DefaultErrorCreator.__init__
lxml.objectify.ElementMaker.__init__
lxml.objectify.ObjectPath.__init__
lxml.objectify.ObjectifyElementClassLookup.__init__
lxml.objectify.PyType.__init__
lxml.sax.ElementTreeContentHandler.__init__
lxml.sax.ElementTreeProducer.__init__
lxml.tests.common_imports.LargeFileLike.__init__
lxml.tests.common_imports.SillyFileLike.__init__
lxml.tests.test_css.CSSTestCase.__init__" class="py-name" href="#" onclick="return doclink('link-13', '__init__', 'link-13');">__init__</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line"> </tt>
<a name="CSSTestCase.all"></a><div id="CSSTestCase.all-def"><a name="L72"></a><tt class="py-lineno"> 72</tt> <a class="py-toggle" href="#" id="CSSTestCase.all-toggle" onclick="return toggle('CSSTestCase.all');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_css.CSSTestCase-class.html#all">all</a><tt class="py-op">(</tt><tt class="py-param">cls</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CSSTestCase.all-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CSSTestCase.all-expanded"><a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">i</tt> <tt class="py-keyword">in</tt> <tt class="py-name">range</tt><tt class="py-op">(</tt><tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">cls</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name"><a title="lxml.tests.test_css.CSSTestCase.selectors" class="py-name" href="#" onclick="return doclink('link-14', 'selectors', 'link-11');">selectors</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line">            <tt class="py-keyword">yield</tt> <tt class="py-name">cls</tt><tt class="py-op">(</tt><tt class="py-name">i</tt><tt class="py-op">)</tt> </tt>
</div><a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line">    <tt id="link-15" class="py-name" targets="Class Method lxml.tests.test_css.CSSTestCase.all()=lxml.tests.test_css.CSSTestCase-class.html#all"><a title="lxml.tests.test_css.CSSTestCase.all" class="py-name" href="#" onclick="return doclink('link-15', 'all', 'link-15');">all</a></tt> <tt class="py-op">=</tt> <tt class="py-name">classmethod</tt><tt class="py-op">(</tt><tt id="link-16" class="py-name"><a title="lxml.tests.test_css.CSSTestCase.all" class="py-name" href="#" onclick="return doclink('link-16', 'all', 'link-15');">all</a></tt><tt class="py-op">)</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line"> </tt>
<a name="CSSTestCase.runTest"></a><div id="CSSTestCase.runTest-def"><a name="L77"></a><tt class="py-lineno"> 77</tt> <a class="py-toggle" href="#" id="CSSTestCase.runTest-toggle" onclick="return toggle('CSSTestCase.runTest');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_css.CSSTestCase-class.html#runTest">runTest</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CSSTestCase.runTest-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CSSTestCase.runTest-expanded"><a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line">        <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt id="link-17" class="py-name"><a title="lxml.tests.test_css.doc_fn" class="py-name" href="#" onclick="return doclink('link-17', 'doc_fn', 'link-8');">doc_fn</a></tt><tt class="py-op">,</tt> <tt class="py-string">'rb'</tt><tt class="py-op">)</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line">        <tt class="py-name">c</tt> <tt class="py-op">=</tt> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name" targets="Method lxml.tests.common_imports.LargeFileLike.read()=lxml.tests.common_imports.LargeFileLike-class.html#read,Method lxml.tests.common_imports.SillyFileLike.read()=lxml.tests.common_imports.SillyFileLike-class.html#read"><a title="lxml.tests.common_imports.LargeFileLike.read
lxml.tests.common_imports.SillyFileLike.read" class="py-name" href="#" onclick="return doclink('link-18', 'read', 'link-18');">read</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line">        <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-19" class="py-name" targets="Method lxml.etree.TreeBuilder.close()=lxml.etree.TreeBuilder-class.html#close"><a title="lxml.etree.TreeBuilder.close" class="py-name" href="#" onclick="return doclink('link-19', 'close', 'link-19');">close</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">        <tt class="py-name">doc</tt> <tt class="py-op">=</tt> <tt id="link-20" class="py-name"><a title="lxml.html" class="py-name" href="#" onclick="return doclink('link-20', 'html', 'link-5');">html</a></tt><tt class="py-op">.</tt><tt id="link-21" class="py-name" targets="Function lxml.html.document_fromstring()=lxml.html-module.html#document_fromstring"><a title="lxml.html.document_fromstring" class="py-name" href="#" onclick="return doclink('link-21', 'document_fromstring', 'link-21');">document_fromstring</a></tt><tt class="py-op">(</tt><tt class="py-name">c</tt><tt class="py-op">)</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line">        <tt class="py-name">body</tt> <tt class="py-op">=</tt> <tt class="py-name">doc</tt><tt class="py-op">.</tt><tt id="link-22" class="py-name" targets="Function lxml.tests.test_xpathevaluator.xpath()=lxml.tests.test_xpathevaluator-module.html#xpath"><a title="lxml.tests.test_xpathevaluator.xpath" class="py-name" href="#" onclick="return doclink('link-22', 'xpath', 'link-22');">xpath</a></tt><tt class="py-op">(</tt><tt class="py-string">'//body'</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line">        <tt class="py-name">bad</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">        <tt class="py-name">selector</tt><tt class="py-op">,</tt> <tt class="py-name">count</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-23" class="py-name"><a title="lxml.tests.test_css.CSSTestCase.selectors" class="py-name" href="#" onclick="return doclink('link-23', 'selectors', 'link-11');">selectors</a></tt><tt class="py-op">[</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">index</tt><tt class="py-op">]</tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">        <tt id="link-24" class="py-name"><a title="lxml.tests.test_xpathevaluator.xpath" class="py-name" href="#" onclick="return doclink('link-24', 'xpath', 'link-22');">xpath</a></tt> <tt class="py-op">=</tt> <tt id="link-25" class="py-name"><a title="lxml.cssselect" class="py-name" href="#" onclick="return doclink('link-25', 'cssselect', 'link-7');">cssselect</a></tt><tt class="py-op">.</tt><tt class="py-name">css_to_xpath</tt><tt class="py-op">(</tt><tt id="link-26" class="py-name"><a title="lxml.cssselect" class="py-name" href="#" onclick="return doclink('link-26', 'cssselect', 'link-7');">cssselect</a></tt><tt class="py-op">.</tt><tt id="link-27" class="py-name" targets="Function lxml.etree.parse()=lxml.etree-module.html#parse,Function lxml.html.ElementSoup.parse()=lxml.html.ElementSoup-module.html#parse,Function lxml.html.soupparser.parse()=lxml.html.soupparser-module.html#parse,Function lxml.objectify.parse()=lxml.objectify-module.html#parse,Method lxml.tests.common_imports.HelperTestCase.parse()=lxml.tests.common_imports.HelperTestCase-class.html#parse"><a title="lxml.etree.parse
lxml.html.ElementSoup.parse
lxml.html.soupparser.parse
lxml.objectify.parse
lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-27', 'parse', 'link-27');">parse</a></tt><tt class="py-op">(</tt><tt class="py-name">selector</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">            <tt class="py-name">results</tt> <tt class="py-op">=</tt> <tt class="py-name">body</tt><tt class="py-op">.</tt><tt id="link-28" class="py-name"><a title="lxml.tests.test_xpathevaluator.xpath" class="py-name" href="#" onclick="return doclink('link-28', 'xpath', 'link-22');">xpath</a></tt><tt class="py-op">(</tt><tt id="link-29" class="py-name"><a title="lxml.tests.test_xpathevaluator.xpath" class="py-name" href="#" onclick="return doclink('link-29', 'xpath', 'link-22');">xpath</a></tt><tt class="py-op">)</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">Exception</tt><tt class="py-op">,</tt> <tt class="py-name">e</tt><tt class="py-op">:</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">            <tt class="py-name">e</tt><tt class="py-op">.</tt><tt class="py-name">args</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-string">"%s for xpath %r"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">e</tt><tt class="py-op">,</tt> <tt id="link-30" class="py-name"><a title="lxml.tests.test_xpathevaluator.xpath" class="py-name" href="#" onclick="return doclink('link-30', 'xpath', 'link-22');">xpath</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line">        <tt class="py-name">found</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">item</tt> <tt class="py-keyword">in</tt> <tt class="py-name">results</tt><tt class="py-op">:</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">item</tt> <tt class="py-keyword">in</tt> <tt class="py-name">found</tt><tt class="py-op">:</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">                <tt class="py-keyword">assert</tt> <tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">                    <tt class="py-string">"Element shows up multiple times: %r"</tt> <tt class="py-op">%</tt> <tt class="py-name">item</tt><tt class="py-op">)</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line">            <tt class="py-name">found</tt><tt class="py-op">[</tt><tt class="py-name">item</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">results</tt><tt class="py-op">,</tt> <tt class="py-name">basestring</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">            <tt class="py-keyword">assert</tt> <tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">                <tt class="py-string">"Got string result (%r), not element, for xpath %r"</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line">                <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">results</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-number">20</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt id="link-31" class="py-name"><a title="lxml.tests.test_xpathevaluator.xpath" class="py-name" href="#" onclick="return doclink('link-31', 'xpath', 'link-22');">xpath</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">results</tt><tt class="py-op">)</tt> <tt class="py-op">!=</tt> <tt class="py-name">count</tt><tt class="py-op">:</tt> </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line">            <tt class="py-comment">#if self.shortDescription() == 'div.character, div.dialog':</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt class="py-comment">#    import pdb; pdb.set_trace()</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line"><tt class="py-comment"></tt>            <tt class="py-keyword">assert</tt> <tt class="py-number">0</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">                <tt class="py-string">"Did not get expected results (%s) instead %s for xpath %r"</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">                <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">count</tt><tt class="py-op">,</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">results</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">str</tt><tt class="py-op">(</tt><tt id="link-32" class="py-name"><a title="lxml.tests.test_xpathevaluator.xpath" class="py-name" href="#" onclick="return doclink('link-32', 'xpath', 'link-22');">xpath</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line"> </tt>
<a name="CSSTestCase.shortDescription"></a><div id="CSSTestCase.shortDescription-def"><a name="L108"></a><tt class="py-lineno">108</tt> <a class="py-toggle" href="#" id="CSSTestCase.shortDescription-toggle" onclick="return toggle('CSSTestCase.shortDescription');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_css.CSSTestCase-class.html#shortDescription">shortDescription</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CSSTestCase.shortDescription-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CSSTestCase.shortDescription-expanded"><a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-33" class="py-name"><a title="lxml.tests.test_css.CSSTestCase.selectors" class="py-name" href="#" onclick="return doclink('link-33', 'selectors', 'link-11');">selectors</a></tt><tt class="py-op">[</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">index</tt><tt class="py-op">]</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
</div></div><a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line"> </tt>
<a name="unique"></a><div id="unique-def"><a name="L111"></a><tt class="py-lineno">111</tt> <a class="py-toggle" href="#" id="unique-toggle" onclick="return toggle('unique');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_css-module.html#unique">unique</a><tt class="py-op">(</tt><tt class="py-param">s</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="unique-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="unique-expanded"><a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line">    <tt class="py-name">found</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line">    <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">item</tt> <tt class="py-keyword">in</tt> <tt class="py-name">s</tt><tt class="py-op">:</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">item</tt> <tt class="py-keyword">in</tt> <tt class="py-name">found</tt><tt class="py-op">:</tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line">            <tt class="py-keyword">continue</tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line">        <tt class="py-name">found</tt><tt class="py-op">[</tt><tt class="py-name">item</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line">        <tt class="py-name">result</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-name">s</tt><tt class="py-op">)</tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">result</tt> </tt>
</div><a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line">         </tt>
<a name="test_suite"></a><div id="test_suite-def"><a name="L121"></a><tt class="py-lineno">121</tt> <a class="py-toggle" href="#" id="test_suite-toggle" onclick="return toggle('test_suite');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_css-module.html#test_suite">test_suite</a><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="test_suite-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="test_suite-expanded"><a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">    <tt class="py-name">suite</tt> <tt class="py-op">=</tt> <tt class="py-name">unittest</tt><tt class="py-op">.</tt><tt class="py-name">TestSuite</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">    <tt class="py-keyword">if</tt> <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">version_info</tt> <tt class="py-op">&gt;=</tt> <tt class="py-op">(</tt><tt class="py-number">2</tt><tt class="py-op">,</tt><tt class="py-number">4</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">        <tt class="py-name">suite</tt><tt class="py-op">.</tt><tt class="py-name">addTests</tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt class="py-name">doctest</tt><tt class="py-op">.</tt><tt class="py-name">DocFileSuite</tt><tt class="py-op">(</tt><tt class="py-string">'test_css_select.txt'</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">    <tt class="py-name">suite</tt><tt class="py-op">.</tt><tt class="py-name">addTests</tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt class="py-name">doctest</tt><tt class="py-op">.</tt><tt class="py-name">DocFileSuite</tt><tt class="py-op">(</tt><tt class="py-string">'test_css.txt'</tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line">    <tt class="py-name">suite</tt><tt class="py-op">.</tt><tt class="py-name">addTests</tt><tt class="py-op">(</tt><tt class="py-name">list</tt><tt class="py-op">(</tt><tt id="link-34" class="py-name" targets="Class lxml.tests.test_css.CSSTestCase=lxml.tests.test_css.CSSTestCase-class.html"><a title="lxml.tests.test_css.CSSTestCase" class="py-name" href="#" onclick="return doclink('link-34', 'CSSTestCase', 'link-34');">CSSTestCase</a></tt><tt class="py-op">.</tt><tt id="link-35" class="py-name"><a title="lxml.tests.test_css.CSSTestCase.all" class="py-name" href="#" onclick="return doclink('link-35', 'all', 'link-15');">all</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">suite</tt> </tt>
</div><a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="lxml-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</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:35 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>