1 <?xml version="1.0" encoding="ascii"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3 "DTD/xhtml1-transitional.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6 <title>lxml.tests.test_errors</title>
7 <link rel="stylesheet" href="epydoc.css" type="text/css" />
8 <script type="text/javascript" src="epydoc.js"></script>
11 <body bgcolor="white" text="black" link="blue" vlink="#204080"
13 <!-- ==================== NAVIGATION BAR ==================== -->
14 <table class="navbar" border="0" width="100%" cellpadding="0"
15 bgcolor="#a0c0ff" cellspacing="0">
18 <th> <a
19 href="lxml-module.html">Home</a> </th>
22 <th> <a
23 href="module-tree.html">Trees</a> </th>
26 <th> <a
27 href="identifier-index.html">Indices</a> </th>
30 <th> <a
31 href="help.html">Help</a> </th>
33 <!-- Project homepage -->
34 <th class="navbar" align="right" width="100%">
35 <table border="0" cellpadding="0" cellspacing="0">
36 <tr><th class="navbar" align="center"
37 ><a class="navbar" target="_top" href="/">lxml API</a></th>
41 <table width="100%" cellpadding="0" cellspacing="0">
44 <span class="breadcrumbs">
45 <a href="lxml-module.html">Package lxml</a> ::
46 <a href="lxml.tests-module.html">Package tests</a> ::
47 Module test_errors
51 <table cellpadding="0" cellspacing="0">
52 <!-- hide/show private -->
53 <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
54 onclick="toggle_private();">hide private</a>]</span></td></tr>
55 <tr><td align="right"><span class="options"
56 >[<a href="frames.html" target="_top">frames</a
57 >] | <a href="lxml.tests.test_errors-pysrc.html"
58 target="_top">no frames</a>]</span></td></tr>
63 <h1 class="epydoc">Source Code for <a href="lxml.tests.test_errors-module.html">Module lxml.tests.test_errors</a></h1>
65 <a name="L1"></a><tt class="py-lineno"> 1</tt> <tt class="py-line"><tt class="py-comment"># -*- coding: utf-8 -*-</tt> </tt>
66 <a name="L2"></a><tt class="py-lineno"> 2</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">doctest</tt> </tt>
67 <a name="L3"></a><tt class="py-lineno"> 3</tt> <tt class="py-line"> </tt>
68 <a name="L4"></a><tt class="py-lineno"> 4</tt> <tt class="py-line"><tt class="py-comment"># These tests check that error handling in the Pyrex code is</tt> </tt>
69 <a name="L5"></a><tt class="py-lineno"> 5</tt> <tt class="py-line"><tt class="py-comment"># complete.</tt> </tt>
70 <a name="L6"></a><tt class="py-lineno"> 6</tt> <tt class="py-line"><tt class="py-comment"># It is likely that if there are errors, instead of failing the code</tt> </tt>
71 <a name="L7"></a><tt class="py-lineno"> 7</tt> <tt class="py-line"><tt class="py-comment"># will simply crash.</tt> </tt>
72 <a name="L8"></a><tt class="py-lineno"> 8</tt> <tt class="py-line"> </tt>
73 <a name="L9"></a><tt class="py-lineno"> 9</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">sys</tt><tt class="py-op">,</tt> <tt class="py-name">gc</tt><tt class="py-op">,</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-0" 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-0', 'path', 'link-0');">path</a></tt> </tt>
74 <a name="L10"></a><tt class="py-lineno">10</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-1" class="py-name" targets="Package lxml=lxml-module.html"><a title="lxml" class="py-name" href="#" onclick="return doclink('link-1', 'lxml', 'link-1');">lxml</a></tt> <tt class="py-keyword">import</tt> <tt id="link-2" class="py-name" targets="Module lxml.etree=lxml.etree-module.html,Variable lxml.sax.ElementTreeContentHandler.etree=lxml.sax.ElementTreeContentHandler-class.html#etree,Variable lxml.tests.test_elementtree.CElementTreeTestCase.etree=lxml.tests.test_elementtree.CElementTreeTestCase-class.html#etree,Variable lxml.tests.test_elementtree.ETreeTestCaseBase.etree=lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#etree,Variable lxml.tests.test_io.IOTestCaseBase.etree=lxml.tests.test_io.IOTestCaseBase-class.html#etree"><a title="lxml.etree
75 lxml.sax.ElementTreeContentHandler.etree
76 lxml.tests.test_elementtree.CElementTreeTestCase.etree
77 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
78 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-2', 'etree', 'link-2');">etree</a></tt> </tt>
79 <a name="L11"></a><tt class="py-lineno">11</tt> <tt class="py-line"> </tt>
80 <a name="L12"></a><tt class="py-lineno">12</tt> <tt class="py-line"><tt id="link-3" class="py-name" targets="Variable lxml.tests.test_classlookup.this_dir=lxml.tests.test_classlookup-module.html#this_dir,Variable lxml.tests.test_dtd.this_dir=lxml.tests.test_dtd-module.html#this_dir,Variable lxml.tests.test_elementtree.this_dir=lxml.tests.test_elementtree-module.html#this_dir,Variable lxml.tests.test_errors.this_dir=lxml.tests.test_errors-module.html#this_dir,Variable lxml.tests.test_etree.this_dir=lxml.tests.test_etree-module.html#this_dir,Variable lxml.tests.test_htmlparser.this_dir=lxml.tests.test_htmlparser-module.html#this_dir,Variable lxml.tests.test_io.this_dir=lxml.tests.test_io-module.html#this_dir,Variable lxml.tests.test_isoschematron.this_dir=lxml.tests.test_isoschematron-module.html#this_dir,Variable lxml.tests.test_nsclasses.this_dir=lxml.tests.test_nsclasses-module.html#this_dir,Variable lxml.tests.test_objectify.this_dir=lxml.tests.test_objectify-module.html#this_dir,Variable lxml.tests.test_pyclasslookup.this_dir=lxml.tests.test_pyclasslookup-module.html#this_dir,Variable lxml.tests.test_relaxng.this_dir=lxml.tests.test_relaxng-module.html#this_dir,Variable lxml.tests.test_sax.this_dir=lxml.tests.test_sax-module.html#this_dir,Variable lxml.tests.test_schematron.this_dir=lxml.tests.test_schematron-module.html#this_dir,Variable lxml.tests.test_threading.this_dir=lxml.tests.test_threading-module.html#this_dir,Variable lxml.tests.test_unicode.this_dir=lxml.tests.test_unicode-module.html#this_dir,Variable lxml.tests.test_xmlschema.this_dir=lxml.tests.test_xmlschema-module.html#this_dir,Variable lxml.tests.test_xpathevaluator.this_dir=lxml.tests.test_xpathevaluator-module.html#this_dir,Variable lxml.tests.test_xslt.this_dir=lxml.tests.test_xslt-module.html#this_dir"><a title="lxml.tests.test_classlookup.this_dir
81 lxml.tests.test_dtd.this_dir
82 lxml.tests.test_elementtree.this_dir
83 lxml.tests.test_errors.this_dir
84 lxml.tests.test_etree.this_dir
85 lxml.tests.test_htmlparser.this_dir
86 lxml.tests.test_io.this_dir
87 lxml.tests.test_isoschematron.this_dir
88 lxml.tests.test_nsclasses.this_dir
89 lxml.tests.test_objectify.this_dir
90 lxml.tests.test_pyclasslookup.this_dir
91 lxml.tests.test_relaxng.this_dir
92 lxml.tests.test_sax.this_dir
93 lxml.tests.test_schematron.this_dir
94 lxml.tests.test_threading.this_dir
95 lxml.tests.test_unicode.this_dir
96 lxml.tests.test_xmlschema.this_dir
97 lxml.tests.test_xpathevaluator.this_dir
98 lxml.tests.test_xslt.this_dir" class="py-name" href="#" onclick="return doclink('link-3', 'this_dir', 'link-3');">this_dir</a></tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-4" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-4', 'path', 'link-0');">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>
99 <a name="L13"></a><tt class="py-lineno">13</tt> <tt class="py-line"><tt class="py-keyword">if</tt> <tt id="link-5" class="py-name"><a title="lxml.tests.test_classlookup.this_dir
100 lxml.tests.test_dtd.this_dir
101 lxml.tests.test_elementtree.this_dir
102 lxml.tests.test_errors.this_dir
103 lxml.tests.test_etree.this_dir
104 lxml.tests.test_htmlparser.this_dir
105 lxml.tests.test_io.this_dir
106 lxml.tests.test_isoschematron.this_dir
107 lxml.tests.test_nsclasses.this_dir
108 lxml.tests.test_objectify.this_dir
109 lxml.tests.test_pyclasslookup.this_dir
110 lxml.tests.test_relaxng.this_dir
111 lxml.tests.test_sax.this_dir
112 lxml.tests.test_schematron.this_dir
113 lxml.tests.test_threading.this_dir
114 lxml.tests.test_unicode.this_dir
115 lxml.tests.test_xmlschema.this_dir
116 lxml.tests.test_xpathevaluator.this_dir
117 lxml.tests.test_xslt.this_dir" class="py-name" href="#" onclick="return doclink('link-5', 'this_dir', 'link-3');">this_dir</a></tt> <tt class="py-keyword">not</tt> <tt class="py-keyword">in</tt> <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt id="link-6" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-6', 'path', 'link-0');">path</a></tt><tt class="py-op">:</tt> </tt>
118 <a name="L14"></a><tt class="py-lineno">14</tt> <tt class="py-line"> <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt id="link-7" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-7', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt id="link-8" class="py-name" targets="Method lxml.etree._Element.insert()=lxml.etree._Element-class.html#insert,Method lxml.etree.__ContentOnlyElement.insert()=lxml.etree.__ContentOnlyElement-class.html#insert"><a title="lxml.etree._Element.insert
119 lxml.etree.__ContentOnlyElement.insert" class="py-name" href="#" onclick="return doclink('link-8', 'insert', 'link-8');">insert</a></tt><tt class="py-op">(</tt><tt class="py-number">0</tt><tt class="py-op">,</tt> <tt id="link-9" class="py-name"><a title="lxml.tests.test_classlookup.this_dir
120 lxml.tests.test_dtd.this_dir
121 lxml.tests.test_elementtree.this_dir
122 lxml.tests.test_errors.this_dir
123 lxml.tests.test_etree.this_dir
124 lxml.tests.test_htmlparser.this_dir
125 lxml.tests.test_io.this_dir
126 lxml.tests.test_isoschematron.this_dir
127 lxml.tests.test_nsclasses.this_dir
128 lxml.tests.test_objectify.this_dir
129 lxml.tests.test_pyclasslookup.this_dir
130 lxml.tests.test_relaxng.this_dir
131 lxml.tests.test_sax.this_dir
132 lxml.tests.test_schematron.this_dir
133 lxml.tests.test_threading.this_dir
134 lxml.tests.test_unicode.this_dir
135 lxml.tests.test_xmlschema.this_dir
136 lxml.tests.test_xpathevaluator.this_dir
137 lxml.tests.test_xslt.this_dir" class="py-name" href="#" onclick="return doclink('link-9', 'this_dir', 'link-3');">this_dir</a></tt><tt class="py-op">)</tt> <tt class="py-comment"># needed for Py3</tt> </tt>
138 <a name="L15"></a><tt class="py-lineno">15</tt> <tt class="py-line"> </tt>
139 <a name="L16"></a><tt class="py-lineno">16</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-10" 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-10', 'common_imports', 'link-10');">common_imports</a></tt> <tt class="py-keyword">import</tt> <tt id="link-11" 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-11', 'HelperTestCase', 'link-11');">HelperTestCase</a></tt> </tt>
140 <a name="L17"></a><tt class="py-lineno">17</tt> <tt class="py-line"> </tt>
141 <a name="ErrorTestCase"></a><div id="ErrorTestCase-def"><a name="L18"></a><tt class="py-lineno">18</tt> <a class="py-toggle" href="#" id="ErrorTestCase-toggle" onclick="return toggle('ErrorTestCase');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lxml.tests.test_errors.ErrorTestCase-class.html">ErrorTestCase</a><tt class="py-op">(</tt><tt class="py-base-class">HelperTestCase</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
142 </div><div id="ErrorTestCase-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="ErrorTestCase-expanded"><a name="L19"></a><tt class="py-lineno">19</tt> <tt class="py-line"> <tt id="link-12" class="py-name"><a title="lxml.etree
143 lxml.sax.ElementTreeContentHandler.etree
144 lxml.tests.test_elementtree.CElementTreeTestCase.etree
145 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
146 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-12', 'etree', 'link-2');">etree</a></tt> <tt class="py-op">=</tt> <tt id="link-13" class="py-name"><a title="lxml.etree
147 lxml.sax.ElementTreeContentHandler.etree
148 lxml.tests.test_elementtree.CElementTreeTestCase.etree
149 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
150 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-13', 'etree', 'link-2');">etree</a></tt> </tt>
151 <a name="L20"></a><tt class="py-lineno">20</tt> <tt class="py-line"> </tt>
152 <a name="ErrorTestCase.test_bad_element"></a><div id="ErrorTestCase.test_bad_element-def"><a name="L21"></a><tt class="py-lineno">21</tt> <a class="py-toggle" href="#" id="ErrorTestCase.test_bad_element-toggle" onclick="return toggle('ErrorTestCase.test_bad_element');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_errors.ErrorTestCase-class.html#test_bad_element">test_bad_element</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
153 </div><div id="ErrorTestCase.test_bad_element-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="ErrorTestCase.test_bad_element-expanded"><a name="L22"></a><tt class="py-lineno">22</tt> <tt class="py-line"> <tt class="py-comment"># attrib argument of Element() should be a dictionary, so if</tt> </tt>
154 <a name="L23"></a><tt class="py-lineno">23</tt> <tt class="py-line"> <tt class="py-comment"># we pass a string we should get an error.</tt> </tt>
155 <a name="L24"></a><tt class="py-lineno">24</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertRaises</tt><tt class="py-op">(</tt><tt class="py-name">TypeError</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name"><a title="lxml.etree
156 lxml.sax.ElementTreeContentHandler.etree
157 lxml.tests.test_elementtree.CElementTreeTestCase.etree
158 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
159 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-14', 'etree', 'link-2');">etree</a></tt><tt class="py-op">.</tt><tt id="link-15" class="py-name" targets="Class lxml.cssselect.Element=lxml.cssselect.Element-class.html,Function lxml.etree.Element()=lxml.etree-module.html#Element,Function lxml.html.Element()=lxml.html-module.html#Element,Function lxml.objectify.Element()=lxml.objectify-module.html#Element,Method lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element()=lxml.tests.test_pyclasslookup.PyClassLookupTestCase-class.html#Element,Class xml.etree.ElementTree.Element=xml.etree.ElementTree.Element-class.html"><a title="lxml.cssselect.Element
162 lxml.objectify.Element
163 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
164 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-15', 'Element', 'link-15');">Element</a></tt><tt class="py-op">,</tt> <tt class="py-string">'a'</tt><tt class="py-op">,</tt> <tt class="py-string">'b'</tt><tt class="py-op">)</tt> </tt>
165 </div><a name="L25"></a><tt class="py-lineno">25</tt> <tt class="py-line"> </tt>
166 <a name="ErrorTestCase.test_empty_parse"></a><div id="ErrorTestCase.test_empty_parse-def"><a name="L26"></a><tt class="py-lineno">26</tt> <a class="py-toggle" href="#" id="ErrorTestCase.test_empty_parse-toggle" onclick="return toggle('ErrorTestCase.test_empty_parse');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_errors.ErrorTestCase-class.html#test_empty_parse">test_empty_parse</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
167 </div><div id="ErrorTestCase.test_empty_parse-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="ErrorTestCase.test_empty_parse-expanded"><a name="L27"></a><tt class="py-lineno">27</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertRaises</tt><tt class="py-op">(</tt><tt id="link-16" class="py-name"><a title="lxml.etree
168 lxml.sax.ElementTreeContentHandler.etree
169 lxml.tests.test_elementtree.CElementTreeTestCase.etree
170 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
171 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-16', 'etree', 'link-2');">etree</a></tt><tt class="py-op">.</tt><tt id="link-17" class="py-name" targets="Class lxml.etree.XMLSyntaxError=lxml.etree.XMLSyntaxError-class.html"><a title="lxml.etree.XMLSyntaxError" class="py-name" href="#" onclick="return doclink('link-17', 'XMLSyntaxError', 'link-17');">XMLSyntaxError</a></tt><tt class="py-op">,</tt> <tt id="link-18" class="py-name"><a title="lxml.etree
172 lxml.sax.ElementTreeContentHandler.etree
173 lxml.tests.test_elementtree.CElementTreeTestCase.etree
174 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
175 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-18', 'etree', 'link-2');">etree</a></tt><tt class="py-op">.</tt><tt id="link-19" class="py-name" targets="Function lxml.etree.fromstring()=lxml.etree-module.html#fromstring,Function lxml.html.fromstring()=lxml.html-module.html#fromstring,Function lxml.html.html5parser.fromstring()=lxml.html.html5parser-module.html#fromstring,Function lxml.html.soupparser.fromstring()=lxml.html.soupparser-module.html#fromstring,Function lxml.objectify.fromstring()=lxml.objectify-module.html#fromstring"><a title="lxml.etree.fromstring
177 lxml.html.html5parser.fromstring
178 lxml.html.soupparser.fromstring
179 lxml.objectify.fromstring" class="py-name" href="#" onclick="return doclink('link-19', 'fromstring', 'link-19');">fromstring</a></tt><tt class="py-op">,</tt> <tt class="py-string">''</tt><tt class="py-op">)</tt> </tt>
180 </div><a name="L28"></a><tt class="py-lineno">28</tt> <tt class="py-line"> </tt>
181 <a name="ErrorTestCase.test_element_cyclic_gc_none"></a><div id="ErrorTestCase.test_element_cyclic_gc_none-def"><a name="L29"></a><tt class="py-lineno">29</tt> <a class="py-toggle" href="#" id="ErrorTestCase.test_element_cyclic_gc_none-toggle" onclick="return toggle('ErrorTestCase.test_element_cyclic_gc_none');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_errors.ErrorTestCase-class.html#test_element_cyclic_gc_none">test_element_cyclic_gc_none</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
182 </div><div id="ErrorTestCase.test_element_cyclic_gc_none-collapsed" style="display:none;" pad="++" indent="++++++++"></div><div id="ErrorTestCase.test_element_cyclic_gc_none-expanded"><a name="L30"></a><tt class="py-lineno">30</tt> <tt class="py-line"> <tt class="py-comment"># test if cyclic reference can crash etree</tt> </tt>
183 <a name="L31"></a><tt class="py-lineno">31</tt> <tt class="py-line"> <tt id="link-20" class="py-name"><a title="lxml.cssselect.Element
186 lxml.objectify.Element
187 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
188 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-20', 'Element', 'link-15');">Element</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-21" class="py-name"><a title="lxml.etree
189 lxml.sax.ElementTreeContentHandler.etree
190 lxml.tests.test_elementtree.CElementTreeTestCase.etree
191 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
192 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-21', 'etree', 'link-2');">etree</a></tt><tt class="py-op">.</tt><tt id="link-22" class="py-name"><a title="lxml.cssselect.Element
195 lxml.objectify.Element
196 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
197 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-22', 'Element', 'link-15');">Element</a></tt> </tt>
198 <a name="L32"></a><tt class="py-lineno">32</tt> <tt class="py-line"> <tt class="py-name">gc</tt><tt class="py-op">.</tt><tt class="py-name">collect</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
199 <a name="L33"></a><tt class="py-lineno">33</tt> <tt class="py-line"> </tt>
200 <a name="L34"></a><tt class="py-lineno">34</tt> <tt class="py-line"> <tt class="py-name">count</tt> <tt class="py-op">=</tt> <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">getrefcount</tt><tt class="py-op">(</tt><tt class="py-name">None</tt><tt class="py-op">)</tt> </tt>
201 <a name="L35"></a><tt class="py-lineno">35</tt> <tt class="py-line"> </tt>
202 <a name="L36"></a><tt class="py-lineno">36</tt> <tt class="py-line"> <tt class="py-name">l</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt id="link-23" class="py-name"><a title="lxml.cssselect.Element
205 lxml.objectify.Element
206 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
207 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-23', 'Element', 'link-15');">Element</a></tt><tt class="py-op">(</tt><tt class="py-string">'name'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt id="link-24" class="py-name"><a title="lxml.cssselect.Element
210 lxml.objectify.Element
211 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
212 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-24', 'Element', 'link-15');">Element</a></tt><tt class="py-op">(</tt><tt class="py-string">'name'</tt><tt class="py-op">)</tt><tt class="py-op">]</tt> </tt>
213 <a name="L37"></a><tt class="py-lineno">37</tt> <tt class="py-line"> <tt class="py-name">l</tt><tt class="py-op">.</tt><tt id="link-25" class="py-name" targets="Method lxml.etree._AppendOnlyElementProxy.append()=lxml.etree._AppendOnlyElementProxy-class.html#append,Method lxml.etree._Element.append()=lxml.etree._Element-class.html#append,Method lxml.etree._OpaqueDocumentWrapper.append()=lxml.etree._OpaqueDocumentWrapper-class.html#append,Method lxml.etree.__ContentOnlyElement.append()=lxml.etree.__ContentOnlyElement-class.html#append"><a title="lxml.etree._AppendOnlyElementProxy.append
214 lxml.etree._Element.append
215 lxml.etree._OpaqueDocumentWrapper.append
216 lxml.etree.__ContentOnlyElement.append" class="py-name" href="#" onclick="return doclink('link-25', 'append', 'link-25');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">l</tt><tt class="py-op">)</tt> </tt>
217 <a name="L38"></a><tt class="py-lineno">38</tt> <tt class="py-line"> </tt>
218 <a name="L39"></a><tt class="py-lineno">39</tt> <tt class="py-line"> <tt class="py-keyword">del</tt> <tt class="py-name">l</tt> </tt>
219 <a name="L40"></a><tt class="py-lineno">40</tt> <tt class="py-line"> <tt class="py-name">gc</tt><tt class="py-op">.</tt><tt class="py-name">collect</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
220 <a name="L41"></a><tt class="py-lineno">41</tt> <tt class="py-line"> </tt>
221 <a name="L42"></a><tt class="py-lineno">42</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEquals</tt><tt class="py-op">(</tt><tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">getrefcount</tt><tt class="py-op">(</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">count</tt><tt class="py-op">)</tt> </tt>
222 </div></div><a name="L43"></a><tt class="py-lineno">43</tt> <tt class="py-line"> </tt>
223 <a name="test_suite"></a><div id="test_suite-def"><a name="L44"></a><tt class="py-lineno">44</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_errors-module.html#test_suite">test_suite</a><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
224 </div><div id="test_suite-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="test_suite-expanded"><a name="L45"></a><tt class="py-lineno">45</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>
225 <a name="L46"></a><tt class="py-lineno">46</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">unittest</tt><tt class="py-op">.</tt><tt class="py-name">makeSuite</tt><tt class="py-op">(</tt><tt id="link-26" class="py-name" targets="Class lxml.tests.test_errors.ErrorTestCase=lxml.tests.test_errors.ErrorTestCase-class.html"><a title="lxml.tests.test_errors.ErrorTestCase" class="py-name" href="#" onclick="return doclink('link-26', 'ErrorTestCase', 'link-26');">ErrorTestCase</a></tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
226 <a name="L47"></a><tt class="py-lineno">47</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">suite</tt> </tt>
227 </div><a name="L48"></a><tt class="py-lineno">48</tt> <tt class="py-line"> </tt>
228 <a name="L49"></a><tt class="py-lineno">49</tt> <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-name">__name__</tt> <tt class="py-op">==</tt> <tt class="py-string">'__main__'</tt><tt class="py-op">:</tt> </tt>
229 <a name="L50"></a><tt class="py-lineno">50</tt> <tt class="py-line"> <tt class="py-keyword">print</tt><tt class="py-op">(</tt><tt class="py-string">'to test use test.py %s'</tt> <tt class="py-op">%</tt> <tt class="py-name">__file__</tt><tt class="py-op">)</tt> </tt>
230 <a name="L51"></a><tt class="py-lineno">51</tt> <tt class="py-line"> </tt><script type="text/javascript">
232 expandto(location.href);
237 <!-- ==================== NAVIGATION BAR ==================== -->
238 <table class="navbar" border="0" width="100%" cellpadding="0"
239 bgcolor="#a0c0ff" cellspacing="0">
242 <th> <a
243 href="lxml-module.html">Home</a> </th>
246 <th> <a
247 href="module-tree.html">Trees</a> </th>
250 <th> <a
251 href="identifier-index.html">Indices</a> </th>
254 <th> <a
255 href="help.html">Help</a> </th>
257 <!-- Project homepage -->
258 <th class="navbar" align="right" width="100%">
259 <table border="0" cellpadding="0" cellspacing="0">
260 <tr><th class="navbar" align="center"
261 ><a class="navbar" target="_top" href="/">lxml API</a></th>
265 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
267 <td align="left" class="footer">
268 Generated by Epydoc 3.0.1 on Tue Jul 31 10:14:20 2012
270 <td align="right" class="footer">
271 <a target="mainFrame" href="http://epydoc.sourceforge.net"
272 >http://epydoc.sourceforge.net</a>
277 <script type="text/javascript">
279 // Private objects are initially displayed (because if
280 // javascript is turned off then we want them to be
281 // visible); but by default, we want to hide them. So hide
282 // them unless we have a cookie that says to show them.