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_io</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> ::
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_io-pysrc.html"
58 target="_top">no frames</a>]</span></td></tr>
63 <h1 class="epydoc">Source Code for <a href="lxml.tests.test_io-module.html">Module lxml.tests.test_io</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>
67 <a name="L3"></a><tt class="py-lineno"> 3</tt> <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
68 <a name="L4"></a><tt class="py-lineno"> 4</tt> <tt class="py-line"><tt class="py-docstring">IO test cases that apply to both etree and ElementTree</tt> </tt>
69 <a name="L5"></a><tt class="py-lineno"> 5</tt> <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
70 <a name="L6"></a><tt class="py-lineno"> 6</tt> <tt class="py-line"> </tt>
71 <a name="L7"></a><tt class="py-lineno"> 7</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">unittest</tt> </tt>
72 <a name="L8"></a><tt class="py-lineno"> 8</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">tempfile</tt><tt class="py-op">,</tt> <tt class="py-name">gzip</tt><tt class="py-op">,</tt> <tt class="py-name">os</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,Variable lxml.etree._LogEntry.path=lxml.etree._LogEntry-class.html#path"><a title="lxml.etree.XPath.path
73 lxml.etree._LogEntry.path" class="py-name" href="#" onclick="return doclink('link-0', 'path', 'link-0');">path</a></tt><tt class="py-op">,</tt> <tt class="py-name">gc</tt><tt class="py-op">,</tt> <tt class="py-name">shutil</tt> </tt>
74 <a name="L9"></a><tt class="py-lineno"> 9</tt> <tt class="py-line"> </tt>
75 <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-op">.</tt><tt id="link-2" class="py-name" targets="Package lxml.tests=lxml.tests-module.html"><a title="lxml.tests" class="py-name" href="#" onclick="return doclink('link-2', 'tests', 'link-2');">tests</a></tt><tt class="py-op">.</tt><tt id="link-3" 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-3', 'common_imports', 'link-3');">common_imports</a></tt> <tt class="py-keyword">import</tt> <tt class="py-op">(</tt> </tt>
76 <a name="L11"></a><tt class="py-lineno"> 11</tt> <tt class="py-line"> <tt id="link-4" 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.CElementTreeElementSlicingTest.etree=lxml.tests.test_elementtree.CElementTreeElementSlicingTest-class.html#etree,Variable lxml.tests.test_elementtree.CElementTreeTestCase.etree=lxml.tests.test_elementtree.CElementTreeTestCase-class.html#etree,Variable lxml.tests.test_elementtree._C14NTest.etree=lxml.tests.test_elementtree._C14NTest-class.html#etree,Variable lxml.tests.test_elementtree._ETreeTestCaseBase.etree=lxml.tests.test_elementtree._ETreeTestCaseBase-class.html#etree,Variable lxml.tests.test_elementtree._ElementSlicingTest.etree=lxml.tests.test_elementtree._ElementSlicingTest-class.html#etree,Variable lxml.tests.test_elementtree._XMLPullParserTest.etree=lxml.tests.test_elementtree._XMLPullParserTest-class.html#etree,Variable lxml.tests.test_io._IOTestCaseBase.etree=lxml.tests.test_io._IOTestCaseBase-class.html#etree"><a title="lxml.etree
77 lxml.sax.ElementTreeContentHandler.etree
78 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
79 lxml.tests.test_elementtree.CElementTreeTestCase.etree
80 lxml.tests.test_elementtree._C14NTest.etree
81 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
82 lxml.tests.test_elementtree._ElementSlicingTest.etree
83 lxml.tests.test_elementtree._XMLPullParserTest.etree
84 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-4', 'etree', 'link-4');">etree</a></tt><tt class="py-op">,</tt> <tt id="link-5" class="py-name" targets="Function lxml.etree.ElementTree()=lxml.etree-module.html#ElementTree,Module xml.etree.ElementTree=xml.etree.ElementTree-module.html,Class xml.etree.ElementTree.ElementTree=xml.etree.ElementTree.ElementTree-class.html"><a title="lxml.etree.ElementTree
86 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-5', 'ElementTree', 'link-5');">ElementTree</a></tt><tt class="py-op">,</tt> <tt id="link-6" class="py-name" targets="Function lxml.tests.common_imports._str()=lxml.tests.common_imports-module.html#_str"><a title="lxml.tests.common_imports._str" class="py-name" href="#" onclick="return doclink('link-6', '_str', 'link-6');">_str</a></tt><tt class="py-op">,</tt> <tt id="link-7" class="py-name" targets="Function lxml.tests.common_imports._bytes()=lxml.tests.common_imports-module.html#_bytes"><a title="lxml.tests.common_imports._bytes" class="py-name" href="#" onclick="return doclink('link-7', '_bytes', 'link-7');">_bytes</a></tt><tt class="py-op">,</tt> </tt>
87 <a name="L12"></a><tt class="py-lineno"> 12</tt> <tt class="py-line"> <tt id="link-8" class="py-name" targets="Class lxml.tests.common_imports.SillyFileLike=lxml.tests.common_imports.SillyFileLike-class.html"><a title="lxml.tests.common_imports.SillyFileLike" class="py-name" href="#" onclick="return doclink('link-8', 'SillyFileLike', 'link-8');">SillyFileLike</a></tt><tt class="py-op">,</tt> <tt id="link-9" class="py-name" targets="Class lxml.tests.common_imports.LargeFileLike=lxml.tests.common_imports.LargeFileLike-class.html"><a title="lxml.tests.common_imports.LargeFileLike" class="py-name" href="#" onclick="return doclink('link-9', 'LargeFileLike', 'link-9');">LargeFileLike</a></tt><tt class="py-op">,</tt> <tt id="link-10" 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-10', 'HelperTestCase', 'link-10');">HelperTestCase</a></tt><tt class="py-op">,</tt> </tt>
88 <a name="L13"></a><tt class="py-lineno"> 13</tt> <tt class="py-line"> <tt id="link-11" class="py-name" targets="Function lxml.tests.common_imports.read_file()=lxml.tests.common_imports-module.html#read_file"><a title="lxml.tests.common_imports.read_file" class="py-name" href="#" onclick="return doclink('link-11', 'read_file', 'link-11');">read_file</a></tt><tt class="py-op">,</tt> <tt id="link-12" class="py-name" targets="Function lxml.tests.common_imports.write_to_file()=lxml.tests.common_imports-module.html#write_to_file"><a title="lxml.tests.common_imports.write_to_file" class="py-name" href="#" onclick="return doclink('link-12', 'write_to_file', 'link-12');">write_to_file</a></tt><tt class="py-op">,</tt> <tt class="py-name">BytesIO</tt><tt class="py-op">,</tt> <tt id="link-13" class="py-name" targets="Function lxml.tests.common_imports.tmpfile()=lxml.tests.common_imports-module.html#tmpfile"><a title="lxml.tests.common_imports.tmpfile" class="py-name" href="#" onclick="return doclink('link-13', 'tmpfile', 'link-13');">tmpfile</a></tt> </tt>
89 <a name="L14"></a><tt class="py-lineno"> 14</tt> <tt class="py-line"><tt class="py-op">)</tt> </tt>
90 <a name="L15"></a><tt class="py-lineno"> 15</tt> <tt class="py-line"> </tt>
91 <a name="L16"></a><tt class="py-lineno"> 16</tt> <tt class="py-line"> </tt>
92 <a name="_IOTestCaseBase"></a><div id="_IOTestCaseBase-def"><a name="L17"></a><tt class="py-lineno"> 17</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase-toggle" onclick="return toggle('_IOTestCaseBase');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html">_IOTestCaseBase</a><tt class="py-op">(</tt><tt class="py-base-class">HelperTestCase</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
93 </div><div id="_IOTestCaseBase-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_IOTestCaseBase-expanded"><a name="L18"></a><tt class="py-lineno"> 18</tt> <tt class="py-line"> <tt class="py-docstring">"""(c)ElementTree compatibility for IO functions/methods</tt> </tt>
94 <a name="L19"></a><tt class="py-lineno"> 19</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
95 <a name="L20"></a><tt class="py-lineno"> 20</tt> <tt class="py-line"> <tt id="link-14" class="py-name"><a title="lxml.etree
96 lxml.sax.ElementTreeContentHandler.etree
97 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
98 lxml.tests.test_elementtree.CElementTreeTestCase.etree
99 lxml.tests.test_elementtree._C14NTest.etree
100 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
101 lxml.tests.test_elementtree._ElementSlicingTest.etree
102 lxml.tests.test_elementtree._XMLPullParserTest.etree
103 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-14', 'etree', 'link-4');">etree</a></tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
104 <a name="L21"></a><tt class="py-lineno"> 21</tt> <tt class="py-line"> </tt>
105 <a name="_IOTestCaseBase.setUp"></a><div id="_IOTestCaseBase.setUp-def"><a name="L22"></a><tt class="py-lineno"> 22</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.setUp-toggle" onclick="return toggle('_IOTestCaseBase.setUp');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#setUp">setUp</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
106 </div><div id="_IOTestCaseBase.setUp-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.setUp-expanded"><a name="L23"></a><tt class="py-lineno"> 23</tt> <tt class="py-line"> <tt class="py-docstring">"""Setting up a minimal tree</tt> </tt>
107 <a name="L24"></a><tt class="py-lineno"> 24</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
108 <a name="L25"></a><tt class="py-lineno"> 25</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-15" class="py-name" targets="Variable lxml.etree.iterparse.root=lxml.etree.iterparse-class.html#root"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-15', 'root', 'link-15');">root</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name"><a title="lxml.etree
109 lxml.sax.ElementTreeContentHandler.etree
110 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
111 lxml.tests.test_elementtree.CElementTreeTestCase.etree
112 lxml.tests.test_elementtree._C14NTest.etree
113 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
114 lxml.tests.test_elementtree._ElementSlicingTest.etree
115 lxml.tests.test_elementtree._XMLPullParserTest.etree
116 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-16', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-17" class="py-name" targets="Function lxml.etree.Element()=lxml.etree-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.etree.Element
117 lxml.objectify.Element
118 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
119 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-17', 'Element', 'link-17');">Element</a></tt><tt class="py-op">(</tt><tt class="py-string">'a'</tt><tt class="py-op">)</tt> </tt>
120 <a name="L26"></a><tt class="py-lineno"> 26</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">root_str</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name"><a title="lxml.etree
121 lxml.sax.ElementTreeContentHandler.etree
122 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
123 lxml.tests.test_elementtree.CElementTreeTestCase.etree
124 lxml.tests.test_elementtree._C14NTest.etree
125 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
126 lxml.tests.test_elementtree._ElementSlicingTest.etree
127 lxml.tests.test_elementtree._XMLPullParserTest.etree
128 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-18', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-19" class="py-name" targets="Method lxml.etree.XSLT.tostring()=lxml.etree.XSLT-class.html#tostring,Function lxml.etree.tostring()=lxml.etree-module.html#tostring"><a title="lxml.etree.XSLT.tostring
129 lxml.etree.tostring" class="py-name" href="#" onclick="return doclink('link-19', 'tostring', 'link-19');">tostring</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-20" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-20', 'root', 'link-15');">root</a></tt><tt class="py-op">)</tt> </tt>
130 <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">tree</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
131 lxml.sax.ElementTreeContentHandler.etree
132 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
133 lxml.tests.test_elementtree.CElementTreeTestCase.etree
134 lxml.tests.test_elementtree._C14NTest.etree
135 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
136 lxml.tests.test_elementtree._ElementSlicingTest.etree
137 lxml.tests.test_elementtree._XMLPullParserTest.etree
138 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-21', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-22" class="py-name"><a title="lxml.etree.ElementTree
139 xml.etree.ElementTree
140 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-22', 'ElementTree', 'link-5');">ElementTree</a></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.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-23', 'root', 'link-15');">root</a></tt><tt class="py-op">)</tt> </tt>
141 <a name="L28"></a><tt class="py-lineno"> 28</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_temp_dir</tt> <tt class="py-op">=</tt> <tt class="py-name">tempfile</tt><tt class="py-op">.</tt><tt class="py-name">mkdtemp</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
142 </div><a name="L29"></a><tt class="py-lineno"> 29</tt> <tt class="py-line"> </tt>
143 <a name="_IOTestCaseBase.tearDown"></a><div id="_IOTestCaseBase.tearDown-def"><a name="L30"></a><tt class="py-lineno"> 30</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.tearDown-toggle" onclick="return toggle('_IOTestCaseBase.tearDown');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#tearDown">tearDown</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
144 </div><div id="_IOTestCaseBase.tearDown-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.tearDown-expanded"><a name="L31"></a><tt class="py-lineno"> 31</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>
145 <a name="L32"></a><tt class="py-lineno"> 32</tt> <tt class="py-line"> <tt class="py-name">shutil</tt><tt class="py-op">.</tt><tt class="py-name">rmtree</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_temp_dir</tt><tt class="py-op">)</tt> </tt>
146 </div><a name="L33"></a><tt class="py-lineno"> 33</tt> <tt class="py-line"> </tt>
147 <a name="_IOTestCaseBase.getTestFilePath"></a><div id="_IOTestCaseBase.getTestFilePath-def"><a name="L34"></a><tt class="py-lineno"> 34</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.getTestFilePath-toggle" onclick="return toggle('_IOTestCaseBase.getTestFilePath');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#getTestFilePath">getTestFilePath</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">name</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
148 </div><div id="_IOTestCaseBase.getTestFilePath-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.getTestFilePath-expanded"><a name="L35"></a><tt class="py-lineno"> 35</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-24" class="py-name"><a title="lxml.etree.XPath.path
149 lxml.etree._LogEntry.path" class="py-name" href="#" onclick="return doclink('link-24', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_temp_dir</tt><tt class="py-op">,</tt> <tt id="link-25" class="py-name" targets="Variable lxml.etree.DTD.name=lxml.etree.DTD-class.html#name,Variable lxml.etree._Entity.name=lxml.etree._Entity-class.html#name,Variable lxml.html.InputMixin.name=lxml.html.InputMixin-class.html#name,Variable lxml.objectify.PyType.name=lxml.objectify.PyType-class.html#name"><a title="lxml.etree.DTD.name
150 lxml.etree._Entity.name
151 lxml.html.InputMixin.name
152 lxml.objectify.PyType.name" class="py-name" href="#" onclick="return doclink('link-25', 'name', 'link-25');">name</a></tt><tt class="py-op">)</tt> </tt>
153 </div><a name="L36"></a><tt class="py-lineno"> 36</tt> <tt class="py-line"> </tt>
154 <a name="_IOTestCaseBase.buildNodes"></a><div id="_IOTestCaseBase.buildNodes-def"><a name="L37"></a><tt class="py-lineno"> 37</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.buildNodes-toggle" onclick="return toggle('_IOTestCaseBase.buildNodes');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#buildNodes">buildNodes</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">element</tt><tt class="py-op">,</tt> <tt class="py-param">children</tt><tt class="py-op">,</tt> <tt class="py-param">depth</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
155 </div><div id="_IOTestCaseBase.buildNodes-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.buildNodes-expanded"><a name="L38"></a><tt class="py-lineno"> 38</tt> <tt class="py-line"> <tt id="link-26" class="py-name"><a title="lxml.etree.Element
156 lxml.objectify.Element
157 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
158 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-26', 'Element', 'link-17');">Element</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name"><a title="lxml.etree
159 lxml.sax.ElementTreeContentHandler.etree
160 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
161 lxml.tests.test_elementtree.CElementTreeTestCase.etree
162 lxml.tests.test_elementtree._C14NTest.etree
163 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
164 lxml.tests.test_elementtree._ElementSlicingTest.etree
165 lxml.tests.test_elementtree._XMLPullParserTest.etree
166 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-27', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-28" class="py-name"><a title="lxml.etree.Element
167 lxml.objectify.Element
168 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
169 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-28', 'Element', 'link-17');">Element</a></tt> </tt>
170 <a name="L39"></a><tt class="py-lineno"> 39</tt> <tt class="py-line"> </tt>
171 <a name="L40"></a><tt class="py-lineno"> 40</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">depth</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
172 <a name="L41"></a><tt class="py-lineno"> 41</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> </tt>
173 <a name="L42"></a><tt class="py-lineno"> 42</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">children</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
174 <a name="L43"></a><tt class="py-lineno"> 43</tt> <tt class="py-line"> <tt class="py-name">new_element</tt> <tt class="py-op">=</tt> <tt id="link-29" class="py-name"><a title="lxml.etree.Element
175 lxml.objectify.Element
176 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
177 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-29', 'Element', 'link-17');">Element</a></tt><tt class="py-op">(</tt><tt class="py-string">'element_%s_%s'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">depth</tt><tt class="py-op">,</tt> <tt class="py-name">i</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
178 <a name="L44"></a><tt class="py-lineno"> 44</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-30" class="py-name" targets="Method lxml.tests.test_io._IOTestCaseBase.buildNodes()=lxml.tests.test_io._IOTestCaseBase-class.html#buildNodes"><a title="lxml.tests.test_io._IOTestCaseBase.buildNodes" class="py-name" href="#" onclick="return doclink('link-30', 'buildNodes', 'link-30');">buildNodes</a></tt><tt class="py-op">(</tt><tt class="py-name">new_element</tt><tt class="py-op">,</tt> <tt class="py-name">children</tt><tt class="py-op">,</tt> <tt class="py-name">depth</tt> <tt class="py-op">-</tt> <tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
179 <a name="L45"></a><tt class="py-lineno"> 45</tt> <tt class="py-line"> <tt id="link-31" class="py-name" targets="Function lxml.tests.selftest2.element()=lxml.tests.selftest2-module.html#element"><a title="lxml.tests.selftest2.element" class="py-name" href="#" onclick="return doclink('link-31', 'element', 'link-31');">element</a></tt><tt class="py-op">.</tt><tt id="link-32" class="py-name" targets="Method lxml.etree._Element.append()=lxml.etree._Element-class.html#append"><a title="lxml.etree._Element.append" class="py-name" href="#" onclick="return doclink('link-32', 'append', 'link-32');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">new_element</tt><tt class="py-op">)</tt> </tt>
180 </div><a name="L46"></a><tt class="py-lineno"> 46</tt> <tt class="py-line"> </tt>
181 <a name="_IOTestCaseBase.test_tree_io"></a><div id="_IOTestCaseBase.test_tree_io-def"><a name="L47"></a><tt class="py-lineno"> 47</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_tree_io-toggle" onclick="return toggle('_IOTestCaseBase.test_tree_io');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_tree_io">test_tree_io</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="_IOTestCaseBase.test_tree_io-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_tree_io-expanded"><a name="L48"></a><tt class="py-lineno"> 48</tt> <tt class="py-line"> <tt id="link-33" class="py-name"><a title="lxml.etree.Element
183 lxml.objectify.Element
184 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
185 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-33', 'Element', 'link-17');">Element</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-34" class="py-name"><a title="lxml.etree
186 lxml.sax.ElementTreeContentHandler.etree
187 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
188 lxml.tests.test_elementtree.CElementTreeTestCase.etree
189 lxml.tests.test_elementtree._C14NTest.etree
190 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
191 lxml.tests.test_elementtree._ElementSlicingTest.etree
192 lxml.tests.test_elementtree._XMLPullParserTest.etree
193 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-34', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-35" class="py-name"><a title="lxml.etree.Element
194 lxml.objectify.Element
195 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
196 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-35', 'Element', 'link-17');">Element</a></tt> </tt>
197 <a name="L49"></a><tt class="py-lineno"> 49</tt> <tt class="py-line"> <tt id="link-36" class="py-name"><a title="lxml.etree.ElementTree
198 xml.etree.ElementTree
199 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-36', 'ElementTree', 'link-5');">ElementTree</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-37" class="py-name"><a title="lxml.etree
200 lxml.sax.ElementTreeContentHandler.etree
201 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
202 lxml.tests.test_elementtree.CElementTreeTestCase.etree
203 lxml.tests.test_elementtree._C14NTest.etree
204 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
205 lxml.tests.test_elementtree._ElementSlicingTest.etree
206 lxml.tests.test_elementtree._XMLPullParserTest.etree
207 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-37', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-38" class="py-name"><a title="lxml.etree.ElementTree
208 xml.etree.ElementTree
209 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-38', 'ElementTree', 'link-5');">ElementTree</a></tt> </tt>
210 <a name="L50"></a><tt class="py-lineno"> 50</tt> <tt class="py-line"> </tt>
211 <a name="L51"></a><tt class="py-lineno"> 51</tt> <tt class="py-line"> <tt id="link-39" class="py-name"><a title="lxml.tests.selftest2.element" class="py-name" href="#" onclick="return doclink('link-39', 'element', 'link-31');">element</a></tt> <tt class="py-op">=</tt> <tt id="link-40" class="py-name"><a title="lxml.etree.Element
212 lxml.objectify.Element
213 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
214 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-40', 'Element', 'link-17');">Element</a></tt><tt class="py-op">(</tt><tt class="py-string">'top'</tt><tt class="py-op">)</tt> </tt>
215 <a name="L52"></a><tt class="py-lineno"> 52</tt> <tt class="py-line"> <tt id="link-41" class="py-name"><a title="lxml.tests.selftest2.element" class="py-name" href="#" onclick="return doclink('link-41', 'element', 'link-31');">element</a></tt><tt class="py-op">.</tt><tt id="link-42" class="py-name" targets="Variable lxml.etree.QName.text=lxml.etree.QName-class.html#text,Variable lxml.etree._Element.text=lxml.etree._Element-class.html#text,Variable lxml.etree._Entity.text=lxml.etree._Entity-class.html#text,Variable lxml.objectify.ObjectifiedElement.text=lxml.objectify.ObjectifiedElement-class.html#text,Variable xml.etree.ElementTree.Element.text=xml.etree.ElementTree.Element-class.html#text"><a title="lxml.etree.QName.text
216 lxml.etree._Element.text
217 lxml.etree._Entity.text
218 lxml.objectify.ObjectifiedElement.text
219 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-42', 'text', 'link-42');">text</a></tt> <tt class="py-op">=</tt> <tt id="link-43" class="py-name"><a title="lxml.tests.common_imports._str" class="py-name" href="#" onclick="return doclink('link-43', '_str', 'link-6');">_str</a></tt><tt class="py-op">(</tt><tt class="py-string">"qwrtioüöä\uAABB"</tt><tt class="py-op">)</tt> </tt>
220 <a name="L53"></a><tt class="py-lineno"> 53</tt> <tt class="py-line"> <tt class="py-name">tree</tt> <tt class="py-op">=</tt> <tt id="link-44" class="py-name"><a title="lxml.etree.ElementTree
221 xml.etree.ElementTree
222 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-44', 'ElementTree', 'link-5');">ElementTree</a></tt><tt class="py-op">(</tt><tt id="link-45" class="py-name"><a title="lxml.tests.selftest2.element" class="py-name" href="#" onclick="return doclink('link-45', 'element', 'link-31');">element</a></tt><tt class="py-op">)</tt> </tt>
223 <a name="L54"></a><tt class="py-lineno"> 54</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-46" class="py-name"><a title="lxml.tests.test_io._IOTestCaseBase.buildNodes" class="py-name" href="#" onclick="return doclink('link-46', 'buildNodes', 'link-30');">buildNodes</a></tt><tt class="py-op">(</tt><tt id="link-47" class="py-name"><a title="lxml.tests.selftest2.element" class="py-name" href="#" onclick="return doclink('link-47', 'element', 'link-31');">element</a></tt><tt class="py-op">,</tt> <tt class="py-number">10</tt><tt class="py-op">,</tt> <tt class="py-number">3</tt><tt class="py-op">)</tt> </tt>
224 <a name="L55"></a><tt class="py-lineno"> 55</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-48" class="py-name" targets="Method lxml.tests.test_io._IOTestCaseBase.getTestFilePath()=lxml.tests.test_io._IOTestCaseBase-class.html#getTestFilePath"><a title="lxml.tests.test_io._IOTestCaseBase.getTestFilePath" class="py-name" href="#" onclick="return doclink('link-48', 'getTestFilePath', 'link-48');">getTestFilePath</a></tt><tt class="py-op">(</tt><tt class="py-string">'testdump.xml'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-string">'wb'</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt class="py-name">f</tt><tt class="py-op">:</tt> </tt>
225 <a name="L56"></a><tt class="py-lineno"> 56</tt> <tt class="py-line"> <tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-49" class="py-name" targets="Method lxml.etree._ElementTree.write()=lxml.etree._ElementTree-class.html#write"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-49', 'write', 'link-49');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">,</tt> <tt id="link-50" class="py-name" targets="Variable lxml.etree.DocInfo.encoding=lxml.etree.DocInfo-class.html#encoding,Function lxml.tests.selftest.encoding()=lxml.tests.selftest-module.html#encoding,Function lxml.tests.selftest2.encoding()=lxml.tests.selftest2-module.html#encoding"><a title="lxml.etree.DocInfo.encoding
226 lxml.tests.selftest.encoding
227 lxml.tests.selftest2.encoding" class="py-name" href="#" onclick="return doclink('link-50', 'encoding', 'link-50');">encoding</a></tt><tt class="py-op">=</tt><tt class="py-string">'UTF-8'</tt><tt class="py-op">)</tt> </tt>
228 <a name="L57"></a><tt class="py-lineno"> 57</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-51" class="py-name"><a title="lxml.tests.test_io._IOTestCaseBase.getTestFilePath" class="py-name" href="#" onclick="return doclink('link-51', 'getTestFilePath', 'link-48');">getTestFilePath</a></tt><tt class="py-op">(</tt><tt class="py-string">'testdump.xml'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-string">'rb'</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt class="py-name">f</tt><tt class="py-op">:</tt> </tt>
229 <a name="L58"></a><tt class="py-lineno"> 58</tt> <tt class="py-line"> <tt class="py-name">tree</tt> <tt class="py-op">=</tt> <tt id="link-52" class="py-name"><a title="lxml.etree.ElementTree
230 xml.etree.ElementTree
231 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-52', 'ElementTree', 'link-5');">ElementTree</a></tt><tt class="py-op">(</tt><tt class="py-name">file</tt><tt class="py-op">=</tt><tt class="py-name">f</tt><tt class="py-op">)</tt> </tt>
232 <a name="L59"></a><tt class="py-lineno"> 59</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-53" class="py-name"><a title="lxml.tests.test_io._IOTestCaseBase.getTestFilePath" class="py-name" href="#" onclick="return doclink('link-53', 'getTestFilePath', 'link-48');">getTestFilePath</a></tt><tt class="py-op">(</tt><tt class="py-string">'testdump2.xml'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-string">'wb'</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt class="py-name">f</tt><tt class="py-op">:</tt> </tt>
233 <a name="L60"></a><tt class="py-lineno"> 60</tt> <tt class="py-line"> <tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-54" class="py-name"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-54', 'write', 'link-49');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">,</tt> <tt id="link-55" class="py-name"><a title="lxml.etree.DocInfo.encoding
234 lxml.tests.selftest.encoding
235 lxml.tests.selftest2.encoding" class="py-name" href="#" onclick="return doclink('link-55', 'encoding', 'link-50');">encoding</a></tt><tt class="py-op">=</tt><tt class="py-string">'UTF-8'</tt><tt class="py-op">)</tt> </tt>
236 <a name="L61"></a><tt class="py-lineno"> 61</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-56" class="py-name"><a title="lxml.tests.test_io._IOTestCaseBase.getTestFilePath" class="py-name" href="#" onclick="return doclink('link-56', 'getTestFilePath', 'link-48');">getTestFilePath</a></tt><tt class="py-op">(</tt><tt class="py-string">'testdump.xml'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-string">'rb'</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt class="py-name">f</tt><tt class="py-op">:</tt> </tt>
237 <a name="L62"></a><tt class="py-lineno"> 62</tt> <tt class="py-line"> <tt class="py-name">data1</tt> <tt class="py-op">=</tt> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-57" 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
238 lxml.tests.common_imports.SillyFileLike.read" class="py-name" href="#" onclick="return doclink('link-57', 'read', 'link-57');">read</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
239 <a name="L63"></a><tt class="py-lineno"> 63</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-58" class="py-name"><a title="lxml.tests.test_io._IOTestCaseBase.getTestFilePath" class="py-name" href="#" onclick="return doclink('link-58', 'getTestFilePath', 'link-48');">getTestFilePath</a></tt><tt class="py-op">(</tt><tt class="py-string">'testdump2.xml'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-string">'rb'</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt class="py-name">f</tt><tt class="py-op">:</tt> </tt>
240 <a name="L64"></a><tt class="py-lineno"> 64</tt> <tt class="py-line"> <tt class="py-name">data2</tt> <tt class="py-op">=</tt> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-59" class="py-name"><a title="lxml.tests.common_imports.LargeFileLike.read
241 lxml.tests.common_imports.SillyFileLike.read" class="py-name" href="#" onclick="return doclink('link-59', 'read', 'link-57');">read</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
242 <a name="L65"></a><tt class="py-lineno"> 65</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-name">data1</tt><tt class="py-op">,</tt> <tt class="py-name">data2</tt><tt class="py-op">)</tt> </tt>
243 </div><a name="L66"></a><tt class="py-lineno"> 66</tt> <tt class="py-line"> </tt>
244 <a name="_IOTestCaseBase.test_tree_io_latin1"></a><div id="_IOTestCaseBase.test_tree_io_latin1-def"><a name="L67"></a><tt class="py-lineno"> 67</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_tree_io_latin1-toggle" onclick="return toggle('_IOTestCaseBase.test_tree_io_latin1');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_tree_io_latin1">test_tree_io_latin1</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
245 </div><div id="_IOTestCaseBase.test_tree_io_latin1-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_tree_io_latin1-expanded"><a name="L68"></a><tt class="py-lineno"> 68</tt> <tt class="py-line"> <tt id="link-60" class="py-name"><a title="lxml.etree.Element
246 lxml.objectify.Element
247 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
248 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-60', 'Element', 'link-17');">Element</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-61" class="py-name"><a title="lxml.etree
249 lxml.sax.ElementTreeContentHandler.etree
250 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
251 lxml.tests.test_elementtree.CElementTreeTestCase.etree
252 lxml.tests.test_elementtree._C14NTest.etree
253 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
254 lxml.tests.test_elementtree._ElementSlicingTest.etree
255 lxml.tests.test_elementtree._XMLPullParserTest.etree
256 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-61', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-62" class="py-name"><a title="lxml.etree.Element
257 lxml.objectify.Element
258 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
259 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-62', 'Element', 'link-17');">Element</a></tt> </tt>
260 <a name="L69"></a><tt class="py-lineno"> 69</tt> <tt class="py-line"> <tt id="link-63" class="py-name"><a title="lxml.etree.ElementTree
261 xml.etree.ElementTree
262 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-63', 'ElementTree', 'link-5');">ElementTree</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-64" class="py-name"><a title="lxml.etree
263 lxml.sax.ElementTreeContentHandler.etree
264 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
265 lxml.tests.test_elementtree.CElementTreeTestCase.etree
266 lxml.tests.test_elementtree._C14NTest.etree
267 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
268 lxml.tests.test_elementtree._ElementSlicingTest.etree
269 lxml.tests.test_elementtree._XMLPullParserTest.etree
270 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-64', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-65" class="py-name"><a title="lxml.etree.ElementTree
271 xml.etree.ElementTree
272 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-65', 'ElementTree', 'link-5');">ElementTree</a></tt> </tt>
273 <a name="L70"></a><tt class="py-lineno"> 70</tt> <tt class="py-line"> </tt>
274 <a name="L71"></a><tt class="py-lineno"> 71</tt> <tt class="py-line"> <tt id="link-66" class="py-name"><a title="lxml.tests.selftest2.element" class="py-name" href="#" onclick="return doclink('link-66', 'element', 'link-31');">element</a></tt> <tt class="py-op">=</tt> <tt id="link-67" class="py-name"><a title="lxml.etree.Element
275 lxml.objectify.Element
276 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
277 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-67', 'Element', 'link-17');">Element</a></tt><tt class="py-op">(</tt><tt class="py-string">'top'</tt><tt class="py-op">)</tt> </tt>
278 <a name="L72"></a><tt class="py-lineno"> 72</tt> <tt class="py-line"> <tt id="link-68" class="py-name"><a title="lxml.tests.selftest2.element" class="py-name" href="#" onclick="return doclink('link-68', 'element', 'link-31');">element</a></tt><tt class="py-op">.</tt><tt id="link-69" class="py-name"><a title="lxml.etree.QName.text
279 lxml.etree._Element.text
280 lxml.etree._Entity.text
281 lxml.objectify.ObjectifiedElement.text
282 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-69', 'text', 'link-42');">text</a></tt> <tt class="py-op">=</tt> <tt id="link-70" class="py-name"><a title="lxml.tests.common_imports._str" class="py-name" href="#" onclick="return doclink('link-70', '_str', 'link-6');">_str</a></tt><tt class="py-op">(</tt><tt class="py-string">"qwrtioüöäßá"</tt><tt class="py-op">)</tt> </tt>
283 <a name="L73"></a><tt class="py-lineno"> 73</tt> <tt class="py-line"> <tt class="py-name">tree</tt> <tt class="py-op">=</tt> <tt id="link-71" class="py-name"><a title="lxml.etree.ElementTree
284 xml.etree.ElementTree
285 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-71', 'ElementTree', 'link-5');">ElementTree</a></tt><tt class="py-op">(</tt><tt id="link-72" class="py-name"><a title="lxml.tests.selftest2.element" class="py-name" href="#" onclick="return doclink('link-72', 'element', 'link-31');">element</a></tt><tt class="py-op">)</tt> </tt>
286 <a name="L74"></a><tt class="py-lineno"> 74</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-73" class="py-name"><a title="lxml.tests.test_io._IOTestCaseBase.buildNodes" class="py-name" href="#" onclick="return doclink('link-73', 'buildNodes', 'link-30');">buildNodes</a></tt><tt class="py-op">(</tt><tt id="link-74" class="py-name"><a title="lxml.tests.selftest2.element" class="py-name" href="#" onclick="return doclink('link-74', 'element', 'link-31');">element</a></tt><tt class="py-op">,</tt> <tt class="py-number">10</tt><tt class="py-op">,</tt> <tt class="py-number">3</tt><tt class="py-op">)</tt> </tt>
287 <a name="L75"></a><tt class="py-lineno"> 75</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-75" class="py-name"><a title="lxml.tests.test_io._IOTestCaseBase.getTestFilePath" class="py-name" href="#" onclick="return doclink('link-75', 'getTestFilePath', 'link-48');">getTestFilePath</a></tt><tt class="py-op">(</tt><tt class="py-string">'testdump.xml'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-string">'wb'</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt class="py-name">f</tt><tt class="py-op">:</tt> </tt>
288 <a name="L76"></a><tt class="py-lineno"> 76</tt> <tt class="py-line"> <tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-76" class="py-name"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-76', 'write', 'link-49');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">,</tt> <tt id="link-77" class="py-name"><a title="lxml.etree.DocInfo.encoding
289 lxml.tests.selftest.encoding
290 lxml.tests.selftest2.encoding" class="py-name" href="#" onclick="return doclink('link-77', 'encoding', 'link-50');">encoding</a></tt><tt class="py-op">=</tt><tt class="py-string">'iso-8859-1'</tt><tt class="py-op">)</tt> </tt>
291 <a name="L77"></a><tt class="py-lineno"> 77</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-78" class="py-name"><a title="lxml.tests.test_io._IOTestCaseBase.getTestFilePath" class="py-name" href="#" onclick="return doclink('link-78', 'getTestFilePath', 'link-48');">getTestFilePath</a></tt><tt class="py-op">(</tt><tt class="py-string">'testdump.xml'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-string">'rb'</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt class="py-name">f</tt><tt class="py-op">:</tt> </tt>
292 <a name="L78"></a><tt class="py-lineno"> 78</tt> <tt class="py-line"> <tt class="py-name">tree</tt> <tt class="py-op">=</tt> <tt id="link-79" class="py-name"><a title="lxml.etree.ElementTree
293 xml.etree.ElementTree
294 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-79', 'ElementTree', 'link-5');">ElementTree</a></tt><tt class="py-op">(</tt><tt class="py-name">file</tt><tt class="py-op">=</tt><tt class="py-name">f</tt><tt class="py-op">)</tt> </tt>
295 <a name="L79"></a><tt class="py-lineno"> 79</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-80" class="py-name"><a title="lxml.tests.test_io._IOTestCaseBase.getTestFilePath" class="py-name" href="#" onclick="return doclink('link-80', 'getTestFilePath', 'link-48');">getTestFilePath</a></tt><tt class="py-op">(</tt><tt class="py-string">'testdump2.xml'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-string">'wb'</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt class="py-name">f</tt><tt class="py-op">:</tt> </tt>
296 <a name="L80"></a><tt class="py-lineno"> 80</tt> <tt class="py-line"> <tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-81" class="py-name"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-81', 'write', 'link-49');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">,</tt> <tt id="link-82" class="py-name"><a title="lxml.etree.DocInfo.encoding
297 lxml.tests.selftest.encoding
298 lxml.tests.selftest2.encoding" class="py-name" href="#" onclick="return doclink('link-82', 'encoding', 'link-50');">encoding</a></tt><tt class="py-op">=</tt><tt class="py-string">'iso-8859-1'</tt><tt class="py-op">)</tt> </tt>
299 <a name="L81"></a><tt class="py-lineno"> 81</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-83" class="py-name"><a title="lxml.tests.test_io._IOTestCaseBase.getTestFilePath" class="py-name" href="#" onclick="return doclink('link-83', 'getTestFilePath', 'link-48');">getTestFilePath</a></tt><tt class="py-op">(</tt><tt class="py-string">'testdump.xml'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-string">'rb'</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt class="py-name">f</tt><tt class="py-op">:</tt> </tt>
300 <a name="L82"></a><tt class="py-lineno"> 82</tt> <tt class="py-line"> <tt class="py-name">data1</tt> <tt class="py-op">=</tt> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-84" class="py-name"><a title="lxml.tests.common_imports.LargeFileLike.read
301 lxml.tests.common_imports.SillyFileLike.read" class="py-name" href="#" onclick="return doclink('link-84', 'read', 'link-57');">read</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
302 <a name="L83"></a><tt class="py-lineno"> 83</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-85" class="py-name"><a title="lxml.tests.test_io._IOTestCaseBase.getTestFilePath" class="py-name" href="#" onclick="return doclink('link-85', 'getTestFilePath', 'link-48');">getTestFilePath</a></tt><tt class="py-op">(</tt><tt class="py-string">'testdump2.xml'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-string">'rb'</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt class="py-name">f</tt><tt class="py-op">:</tt> </tt>
303 <a name="L84"></a><tt class="py-lineno"> 84</tt> <tt class="py-line"> <tt class="py-name">data2</tt> <tt class="py-op">=</tt> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-86" class="py-name"><a title="lxml.tests.common_imports.LargeFileLike.read
304 lxml.tests.common_imports.SillyFileLike.read" class="py-name" href="#" onclick="return doclink('link-86', 'read', 'link-57');">read</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
305 <a name="L85"></a><tt class="py-lineno"> 85</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-name">data1</tt><tt class="py-op">,</tt> <tt class="py-name">data2</tt><tt class="py-op">)</tt> </tt>
306 </div><a name="L86"></a><tt class="py-lineno"> 86</tt> <tt class="py-line"> </tt>
307 <a name="_IOTestCaseBase.test_write_filename"></a><div id="_IOTestCaseBase.test_write_filename-def"><a name="L87"></a><tt class="py-lineno"> 87</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_write_filename-toggle" onclick="return toggle('_IOTestCaseBase.test_write_filename');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_write_filename">test_write_filename</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
308 </div><div id="_IOTestCaseBase.test_write_filename-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_write_filename-expanded"><a name="L88"></a><tt class="py-lineno"> 88</tt> <tt class="py-line"> <tt class="py-comment"># (c)ElementTree supports filename strings as write argument</tt> </tt>
309 <a name="L89"></a><tt class="py-lineno"> 89</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt id="link-87" class="py-name"><a title="lxml.tests.common_imports.tmpfile" class="py-name" href="#" onclick="return doclink('link-87', 'tmpfile', 'link-13');">tmpfile</a></tt><tt class="py-op">(</tt><tt id="link-88" class="py-name" targets="Variable lxml.etree._Element.prefix=lxml.etree._Element-class.html#prefix"><a title="lxml.etree._Element.prefix" class="py-name" href="#" onclick="return doclink('link-88', 'prefix', 'link-88');">prefix</a></tt><tt class="py-op">=</tt><tt class="py-string">"p"</tt><tt class="py-op">,</tt> <tt class="py-name">suffix</tt><tt class="py-op">=</tt><tt class="py-string">".xml"</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt id="link-89" class="py-name" targets="Variable lxml.etree._LogEntry.filename=lxml.etree._LogEntry-class.html#filename"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-89', 'filename', 'link-89');">filename</a></tt><tt class="py-op">:</tt> </tt>
310 <a name="L90"></a><tt class="py-lineno"> 90</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-90" class="py-name"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-90', 'write', 'link-49');">write</a></tt><tt class="py-op">(</tt><tt id="link-91" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-91', 'filename', 'link-89');">filename</a></tt><tt class="py-op">)</tt> </tt>
311 <a name="L91"></a><tt class="py-lineno"> 91</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt id="link-92" class="py-name"><a title="lxml.tests.common_imports.read_file" class="py-name" href="#" onclick="return doclink('link-92', 'read_file', 'link-11');">read_file</a></tt><tt class="py-op">(</tt><tt id="link-93" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-93', 'filename', 'link-89');">filename</a></tt><tt class="py-op">,</tt> <tt class="py-string">'rb'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-94" class="py-name" targets="Method lxml.etree._Element.replace()=lxml.etree._Element-class.html#replace"><a title="lxml.etree._Element.replace" class="py-name" href="#" onclick="return doclink('link-94', 'replace', 'link-94');">replace</a></tt><tt class="py-op">(</tt><tt class="py-string">b'\n'</tt><tt class="py-op">,</tt> <tt class="py-string">b''</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
312 <a name="L92"></a><tt class="py-lineno"> 92</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">root_str</tt><tt class="py-op">)</tt> </tt>
313 </div><a name="L93"></a><tt class="py-lineno"> 93</tt> <tt class="py-line"> </tt>
314 <a name="_IOTestCaseBase.test_write_filename_special_percent"></a><div id="_IOTestCaseBase.test_write_filename_special_percent-def"><a name="L94"></a><tt class="py-lineno"> 94</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_write_filename_special_percent-toggle" onclick="return toggle('_IOTestCaseBase.test_write_filename_special_percent');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_write_filename_special_percent">test_write_filename_special_percent</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
315 </div><div id="_IOTestCaseBase.test_write_filename_special_percent-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_write_filename_special_percent-expanded"><a name="L95"></a><tt class="py-lineno"> 95</tt> <tt class="py-line"> <tt class="py-comment"># '%20' is a URL escaped space character.</tt> </tt>
316 <a name="L96"></a><tt class="py-lineno"> 96</tt> <tt class="py-line"> <tt class="py-name">before_test</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">listdir</tt><tt class="py-op">(</tt><tt class="py-name">tempfile</tt><tt class="py-op">.</tt><tt class="py-name">gettempdir</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
317 <a name="L97"></a><tt class="py-lineno"> 97</tt> <tt class="py-line"> </tt>
318 <a name="L98"></a><tt class="py-lineno"> 98</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">difference</tt><tt class="py-op">(</tt><tt class="py-param">filenames</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
319 <a name="L99"></a><tt class="py-lineno"> 99</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">sorted</tt><tt class="py-op">(</tt> </tt>
320 <a name="L100"></a><tt class="py-lineno">100</tt> <tt class="py-line"> <tt class="py-name">fn</tt> <tt class="py-keyword">for</tt> <tt class="py-name">fn</tt> <tt class="py-keyword">in</tt> <tt id="link-95" class="py-name" targets="Method lxml.etree._Element.set()=lxml.etree._Element-class.html#set,Method lxml.etree._XSLTProcessingInstruction.set()=lxml.etree._XSLTProcessingInstruction-class.html#set,Method lxml.html.HtmlElement.set()=lxml.html.HtmlElement-class.html#set,Method lxml.html.HtmlMixin.set()=lxml.html.HtmlMixin-class.html#set"><a title="lxml.etree._Element.set
321 lxml.etree._XSLTProcessingInstruction.set
322 lxml.html.HtmlElement.set
323 lxml.html.HtmlMixin.set" class="py-name" href="#" onclick="return doclink('link-95', 'set', 'link-95');">set</a></tt><tt class="py-op">(</tt><tt class="py-name">filenames</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">difference</tt><tt class="py-op">(</tt><tt class="py-name">before_test</tt><tt class="py-op">)</tt> </tt>
324 <a name="L101"></a><tt class="py-lineno">101</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">fn</tt><tt class="py-op">.</tt><tt class="py-name">startswith</tt><tt class="py-op">(</tt><tt class="py-string">'lxmltmp-'</tt><tt class="py-op">)</tt> </tt>
325 <a name="L102"></a><tt class="py-lineno">102</tt> <tt class="py-line"> <tt class="py-op">)</tt> </tt>
326 </div><a name="L103"></a><tt class="py-lineno">103</tt> <tt class="py-line"> </tt>
327 <a name="L104"></a><tt class="py-lineno">104</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt id="link-96" class="py-name"><a title="lxml.tests.common_imports.tmpfile" class="py-name" href="#" onclick="return doclink('link-96', 'tmpfile', 'link-13');">tmpfile</a></tt><tt class="py-op">(</tt><tt id="link-97" class="py-name"><a title="lxml.etree._Element.prefix" class="py-name" href="#" onclick="return doclink('link-97', 'prefix', 'link-88');">prefix</a></tt><tt class="py-op">=</tt><tt class="py-string">"lxmltmp-p%20p"</tt><tt class="py-op">,</tt> <tt class="py-name">suffix</tt><tt class="py-op">=</tt><tt class="py-string">".xml"</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt id="link-98" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-98', 'filename', 'link-89');">filename</a></tt><tt class="py-op">:</tt> </tt>
328 <a name="L105"></a><tt class="py-lineno">105</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
329 <a name="L106"></a><tt class="py-lineno">106</tt> <tt class="py-line"> <tt class="py-name">before_write</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">listdir</tt><tt class="py-op">(</tt><tt class="py-name">tempfile</tt><tt class="py-op">.</tt><tt class="py-name">gettempdir</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
330 <a name="L107"></a><tt class="py-lineno">107</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-99" class="py-name"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-99', 'write', 'link-49');">write</a></tt><tt class="py-op">(</tt><tt id="link-100" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-100', 'filename', 'link-89');">filename</a></tt><tt class="py-op">)</tt> </tt>
331 <a name="L108"></a><tt class="py-lineno">108</tt> <tt class="py-line"> <tt class="py-name">after_write</tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">listdir</tt><tt class="py-op">(</tt><tt class="py-name">tempfile</tt><tt class="py-op">.</tt><tt class="py-name">gettempdir</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
332 <a name="L109"></a><tt class="py-lineno">109</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt id="link-101" class="py-name"><a title="lxml.tests.common_imports.read_file" class="py-name" href="#" onclick="return doclink('link-101', 'read_file', 'link-11');">read_file</a></tt><tt class="py-op">(</tt><tt id="link-102" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-102', 'filename', 'link-89');">filename</a></tt><tt class="py-op">,</tt> <tt class="py-string">'rb'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-103" class="py-name"><a title="lxml.etree._Element.replace" class="py-name" href="#" onclick="return doclink('link-103', 'replace', 'link-94');">replace</a></tt><tt class="py-op">(</tt><tt class="py-string">b'\n'</tt><tt class="py-op">,</tt> <tt class="py-string">b''</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
333 <a name="L110"></a><tt class="py-lineno">110</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">root_str</tt><tt class="py-op">)</tt> </tt>
334 <a name="L111"></a><tt class="py-lineno">111</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-op">(</tt><tt id="link-104" class="py-name" targets="Class exceptions.AssertionError=exceptions.AssertionError-class.html"><a title="exceptions.AssertionError" class="py-name" href="#" onclick="return doclink('link-104', 'AssertionError', 'link-104');">AssertionError</a></tt><tt class="py-op">,</tt> <tt class="py-name">IOError</tt><tt class="py-op">,</tt> <tt class="py-name">OSError</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
335 <a name="L112"></a><tt class="py-lineno">112</tt> <tt class="py-line"> <tt class="py-keyword">print</tt><tt class="py-op">(</tt><tt class="py-string">"Before write: %s, after write: %s"</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt> </tt>
336 <a name="L113"></a><tt class="py-lineno">113</tt> <tt class="py-line"> <tt class="py-name">difference</tt><tt class="py-op">(</tt><tt class="py-name">before_write</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">difference</tt><tt class="py-op">(</tt><tt class="py-name">after_write</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
337 <a name="L114"></a><tt class="py-lineno">114</tt> <tt class="py-line"> <tt class="py-op">)</tt> </tt>
338 <a name="L115"></a><tt class="py-lineno">115</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> </tt>
339 </div><a name="L116"></a><tt class="py-lineno">116</tt> <tt class="py-line"> </tt>
340 <a name="_IOTestCaseBase.test_write_filename_special_plus"></a><div id="_IOTestCaseBase.test_write_filename_special_plus-def"><a name="L117"></a><tt class="py-lineno">117</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_write_filename_special_plus-toggle" onclick="return toggle('_IOTestCaseBase.test_write_filename_special_plus');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_write_filename_special_plus">test_write_filename_special_plus</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
341 </div><div id="_IOTestCaseBase.test_write_filename_special_plus-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_write_filename_special_plus-expanded"><a name="L118"></a><tt class="py-lineno">118</tt> <tt class="py-line"> <tt class="py-comment"># '+' is used as an escaped space character in URLs.</tt> </tt>
342 <a name="L119"></a><tt class="py-lineno">119</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt id="link-105" class="py-name"><a title="lxml.tests.common_imports.tmpfile" class="py-name" href="#" onclick="return doclink('link-105', 'tmpfile', 'link-13');">tmpfile</a></tt><tt class="py-op">(</tt><tt id="link-106" class="py-name"><a title="lxml.etree._Element.prefix" class="py-name" href="#" onclick="return doclink('link-106', 'prefix', 'link-88');">prefix</a></tt><tt class="py-op">=</tt><tt class="py-string">"p+"</tt><tt class="py-op">,</tt> <tt class="py-name">suffix</tt><tt class="py-op">=</tt><tt class="py-string">".xml"</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt id="link-107" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-107', 'filename', 'link-89');">filename</a></tt><tt class="py-op">:</tt> </tt>
343 <a name="L120"></a><tt class="py-lineno">120</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-108" class="py-name"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-108', 'write', 'link-49');">write</a></tt><tt class="py-op">(</tt><tt id="link-109" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-109', 'filename', 'link-89');">filename</a></tt><tt class="py-op">)</tt> </tt>
344 <a name="L121"></a><tt class="py-lineno">121</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt id="link-110" class="py-name"><a title="lxml.tests.common_imports.read_file" class="py-name" href="#" onclick="return doclink('link-110', 'read_file', 'link-11');">read_file</a></tt><tt class="py-op">(</tt><tt id="link-111" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-111', 'filename', 'link-89');">filename</a></tt><tt class="py-op">,</tt> <tt class="py-string">'rb'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-112" class="py-name"><a title="lxml.etree._Element.replace" class="py-name" href="#" onclick="return doclink('link-112', 'replace', 'link-94');">replace</a></tt><tt class="py-op">(</tt><tt class="py-string">b'\n'</tt><tt class="py-op">,</tt> <tt class="py-string">b''</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
345 <a name="L122"></a><tt class="py-lineno">122</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">root_str</tt><tt class="py-op">)</tt> </tt>
346 </div><a name="L123"></a><tt class="py-lineno">123</tt> <tt class="py-line"> </tt>
347 <a name="_IOTestCaseBase.test_write_invalid_filename"></a><div id="_IOTestCaseBase.test_write_invalid_filename-def"><a name="L124"></a><tt class="py-lineno">124</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_write_invalid_filename-toggle" onclick="return toggle('_IOTestCaseBase.test_write_invalid_filename');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_write_invalid_filename">test_write_invalid_filename</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
348 </div><div id="_IOTestCaseBase.test_write_invalid_filename-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_write_invalid_filename-expanded"><a name="L125"></a><tt class="py-lineno">125</tt> <tt class="py-line"> <tt id="link-113" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-113', 'filename', 'link-89');">filename</a></tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-114" class="py-name"><a title="lxml.etree.XPath.path
349 lxml.etree._LogEntry.path" class="py-name" href="#" onclick="return doclink('link-114', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt> </tt>
350 <a name="L126"></a><tt class="py-lineno">126</tt> <tt class="py-line"> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-115" class="py-name"><a title="lxml.etree.XPath.path
351 lxml.etree._LogEntry.path" class="py-name" href="#" onclick="return doclink('link-115', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-string">'hopefullynonexistingpathname'</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
352 <a name="L127"></a><tt class="py-lineno">127</tt> <tt class="py-line"> <tt class="py-string">'invalid_file.xml'</tt><tt class="py-op">)</tt> </tt>
353 <a name="L128"></a><tt class="py-lineno">128</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
354 <a name="L129"></a><tt class="py-lineno">129</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-116" class="py-name"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-116', 'write', 'link-49');">write</a></tt><tt class="py-op">(</tt><tt id="link-117" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-117', 'filename', 'link-89');">filename</a></tt><tt class="py-op">)</tt> </tt>
355 <a name="L130"></a><tt class="py-lineno">130</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">IOError</tt><tt class="py-op">:</tt> </tt>
356 <a name="L131"></a><tt class="py-lineno">131</tt> <tt class="py-line"> <tt class="py-keyword">pass</tt> </tt>
357 <a name="L132"></a><tt class="py-lineno">132</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
358 <a name="L133"></a><tt class="py-lineno">133</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertTrue</tt><tt class="py-op">(</tt> </tt>
359 <a name="L134"></a><tt class="py-lineno">134</tt> <tt class="py-line"> <tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-string">"writing to an invalid file path should fail"</tt><tt class="py-op">)</tt> </tt>
360 </div><a name="L135"></a><tt class="py-lineno">135</tt> <tt class="py-line"> </tt>
361 <a name="_IOTestCaseBase.test_module_parse_gzipobject"></a><div id="_IOTestCaseBase.test_module_parse_gzipobject-def"><a name="L136"></a><tt class="py-lineno">136</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_module_parse_gzipobject-toggle" onclick="return toggle('_IOTestCaseBase.test_module_parse_gzipobject');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_module_parse_gzipobject">test_module_parse_gzipobject</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
362 </div><div id="_IOTestCaseBase.test_module_parse_gzipobject-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_module_parse_gzipobject-expanded"><a name="L137"></a><tt class="py-lineno">137</tt> <tt class="py-line"> <tt class="py-comment"># (c)ElementTree supports gzip instance as parse argument</tt> </tt>
363 <a name="L138"></a><tt class="py-lineno">138</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt id="link-118" class="py-name"><a title="lxml.tests.common_imports.tmpfile" class="py-name" href="#" onclick="return doclink('link-118', 'tmpfile', 'link-13');">tmpfile</a></tt><tt class="py-op">(</tt><tt class="py-name">suffix</tt><tt class="py-op">=</tt><tt class="py-string">".xml.gz"</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt id="link-119" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-119', 'filename', 'link-89');">filename</a></tt><tt class="py-op">:</tt> </tt>
364 <a name="L139"></a><tt class="py-lineno">139</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt class="py-name">gzip</tt><tt class="py-op">.</tt><tt class="py-name">open</tt><tt class="py-op">(</tt><tt id="link-120" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-120', 'filename', 'link-89');">filename</a></tt><tt class="py-op">,</tt> <tt class="py-string">'wb'</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt class="py-name">f</tt><tt class="py-op">:</tt> </tt>
365 <a name="L140"></a><tt class="py-lineno">140</tt> <tt class="py-line"> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-121" class="py-name"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-121', 'write', 'link-49');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">root_str</tt><tt class="py-op">)</tt> </tt>
366 <a name="L141"></a><tt class="py-lineno">141</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt class="py-name">gzip</tt><tt class="py-op">.</tt><tt class="py-name">open</tt><tt class="py-op">(</tt><tt id="link-122" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-122', 'filename', 'link-89');">filename</a></tt><tt class="py-op">,</tt> <tt class="py-string">'rb'</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt class="py-name">f_gz</tt><tt class="py-op">:</tt> </tt>
367 <a name="L142"></a><tt class="py-lineno">142</tt> <tt class="py-line"> <tt class="py-name">tree</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-123" class="py-name"><a title="lxml.etree
368 lxml.sax.ElementTreeContentHandler.etree
369 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
370 lxml.tests.test_elementtree.CElementTreeTestCase.etree
371 lxml.tests.test_elementtree._C14NTest.etree
372 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
373 lxml.tests.test_elementtree._ElementSlicingTest.etree
374 lxml.tests.test_elementtree._XMLPullParserTest.etree
375 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-123', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-124" class="py-name" targets="Method lxml.etree._ElementTree.parse()=lxml.etree._ElementTree-class.html#parse,Function lxml.etree.parse()=lxml.etree-module.html#parse,Function lxml.html.ElementSoup.parse()=lxml.html.ElementSoup-module.html#parse,Function lxml.html.html5parser.parse()=lxml.html.html5parser-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._ElementTree.parse
377 lxml.html.ElementSoup.parse
378 lxml.html.html5parser.parse
379 lxml.html.soupparser.parse
381 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-124', 'parse', 'link-124');">parse</a></tt><tt class="py-op">(</tt><tt class="py-name">f_gz</tt><tt class="py-op">)</tt> </tt>
382 <a name="L143"></a><tt class="py-lineno">143</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-125" class="py-name"><a title="lxml.etree
383 lxml.sax.ElementTreeContentHandler.etree
384 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
385 lxml.tests.test_elementtree.CElementTreeTestCase.etree
386 lxml.tests.test_elementtree._C14NTest.etree
387 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
388 lxml.tests.test_elementtree._ElementSlicingTest.etree
389 lxml.tests.test_elementtree._XMLPullParserTest.etree
390 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-125', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-126" class="py-name"><a title="lxml.etree.XSLT.tostring
391 lxml.etree.tostring" class="py-name" href="#" onclick="return doclink('link-126', 'tostring', 'link-19');">tostring</a></tt><tt class="py-op">(</tt><tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-127" class="py-name" targets="Method lxml.etree._ElementTree.getroot()=lxml.etree._ElementTree-class.html#getroot"><a title="lxml.etree._ElementTree.getroot" class="py-name" href="#" onclick="return doclink('link-127', 'getroot', 'link-127');">getroot</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">root_str</tt><tt class="py-op">)</tt> </tt>
392 </div><a name="L144"></a><tt class="py-lineno">144</tt> <tt class="py-line"> </tt>
393 <a name="_IOTestCaseBase.test_class_parse_filename"></a><div id="_IOTestCaseBase.test_class_parse_filename-def"><a name="L145"></a><tt class="py-lineno">145</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_class_parse_filename-toggle" onclick="return toggle('_IOTestCaseBase.test_class_parse_filename');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_class_parse_filename">test_class_parse_filename</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
394 </div><div id="_IOTestCaseBase.test_class_parse_filename-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_class_parse_filename-expanded"><a name="L146"></a><tt class="py-lineno">146</tt> <tt class="py-line"> <tt class="py-comment"># (c)ElementTree class ElementTree has a 'parse' method that returns</tt> </tt>
395 <a name="L147"></a><tt class="py-lineno">147</tt> <tt class="py-line"> <tt class="py-comment"># the root of the tree</tt> </tt>
396 <a name="L148"></a><tt class="py-lineno">148</tt> <tt class="py-line"> </tt>
397 <a name="L149"></a><tt class="py-lineno">149</tt> <tt class="py-line"> <tt class="py-comment"># parse from filename</tt> </tt>
398 <a name="L150"></a><tt class="py-lineno">150</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt id="link-128" class="py-name"><a title="lxml.tests.common_imports.tmpfile" class="py-name" href="#" onclick="return doclink('link-128', 'tmpfile', 'link-13');">tmpfile</a></tt><tt class="py-op">(</tt><tt class="py-name">suffix</tt><tt class="py-op">=</tt><tt class="py-string">".xml"</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt id="link-129" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-129', 'filename', 'link-89');">filename</a></tt><tt class="py-op">:</tt> </tt>
399 <a name="L151"></a><tt class="py-lineno">151</tt> <tt class="py-line"> <tt id="link-130" class="py-name"><a title="lxml.tests.common_imports.write_to_file" class="py-name" href="#" onclick="return doclink('link-130', 'write_to_file', 'link-12');">write_to_file</a></tt><tt class="py-op">(</tt><tt id="link-131" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-131', 'filename', 'link-89');">filename</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">root_str</tt><tt class="py-op">,</tt> <tt class="py-string">'wb'</tt><tt class="py-op">)</tt> </tt>
400 <a name="L152"></a><tt class="py-lineno">152</tt> <tt class="py-line"> <tt class="py-name">tree</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-132" class="py-name"><a title="lxml.etree
401 lxml.sax.ElementTreeContentHandler.etree
402 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
403 lxml.tests.test_elementtree.CElementTreeTestCase.etree
404 lxml.tests.test_elementtree._C14NTest.etree
405 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
406 lxml.tests.test_elementtree._ElementSlicingTest.etree
407 lxml.tests.test_elementtree._XMLPullParserTest.etree
408 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-132', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-133" class="py-name"><a title="lxml.etree.ElementTree
409 xml.etree.ElementTree
410 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-133', 'ElementTree', 'link-5');">ElementTree</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
411 <a name="L153"></a><tt class="py-lineno">153</tt> <tt class="py-line"> <tt id="link-134" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-134', 'root', 'link-15');">root</a></tt> <tt class="py-op">=</tt> <tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-135" class="py-name"><a title="lxml.etree._ElementTree.parse
413 lxml.html.ElementSoup.parse
414 lxml.html.html5parser.parse
415 lxml.html.soupparser.parse
417 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-135', 'parse', 'link-124');">parse</a></tt><tt class="py-op">(</tt><tt id="link-136" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-136', 'filename', 'link-89');">filename</a></tt><tt class="py-op">)</tt> </tt>
418 <a name="L154"></a><tt class="py-lineno">154</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-137" class="py-name"><a title="lxml.etree
419 lxml.sax.ElementTreeContentHandler.etree
420 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
421 lxml.tests.test_elementtree.CElementTreeTestCase.etree
422 lxml.tests.test_elementtree._C14NTest.etree
423 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
424 lxml.tests.test_elementtree._ElementSlicingTest.etree
425 lxml.tests.test_elementtree._XMLPullParserTest.etree
426 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-137', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-138" class="py-name"><a title="lxml.etree.XSLT.tostring
427 lxml.etree.tostring" class="py-name" href="#" onclick="return doclink('link-138', 'tostring', 'link-19');">tostring</a></tt><tt class="py-op">(</tt><tt id="link-139" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-139', 'root', 'link-15');">root</a></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">root_str</tt><tt class="py-op">)</tt> </tt>
428 </div><a name="L155"></a><tt class="py-lineno">155</tt> <tt class="py-line"> </tt>
429 <a name="_IOTestCaseBase.test_class_parse_filename_remove_previous"></a><div id="_IOTestCaseBase.test_class_parse_filename_remove_previous-def"><a name="L156"></a><tt class="py-lineno">156</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_class_parse_filename_remove_previous-toggle" onclick="return toggle('_IOTestCaseBase.test_class_parse_filename_remove_previous');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_class_parse_filename_remove_previous">test_class_parse_filename_remove_previous</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
430 </div><div id="_IOTestCaseBase.test_class_parse_filename_remove_previous-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_class_parse_filename_remove_previous-expanded"><a name="L157"></a><tt class="py-lineno">157</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt id="link-140" class="py-name"><a title="lxml.tests.common_imports.tmpfile" class="py-name" href="#" onclick="return doclink('link-140', 'tmpfile', 'link-13');">tmpfile</a></tt><tt class="py-op">(</tt><tt class="py-name">suffix</tt><tt class="py-op">=</tt><tt class="py-string">".xml"</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt id="link-141" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-141', 'filename', 'link-89');">filename</a></tt><tt class="py-op">:</tt> </tt>
431 <a name="L158"></a><tt class="py-lineno">158</tt> <tt class="py-line"> <tt id="link-142" class="py-name"><a title="lxml.tests.common_imports.write_to_file" class="py-name" href="#" onclick="return doclink('link-142', 'write_to_file', 'link-12');">write_to_file</a></tt><tt class="py-op">(</tt><tt id="link-143" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-143', 'filename', 'link-89');">filename</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">root_str</tt><tt class="py-op">,</tt> <tt class="py-string">'wb'</tt><tt class="py-op">)</tt> </tt>
432 <a name="L159"></a><tt class="py-lineno">159</tt> <tt class="py-line"> <tt class="py-name">tree</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-144" class="py-name"><a title="lxml.etree
433 lxml.sax.ElementTreeContentHandler.etree
434 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
435 lxml.tests.test_elementtree.CElementTreeTestCase.etree
436 lxml.tests.test_elementtree._C14NTest.etree
437 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
438 lxml.tests.test_elementtree._ElementSlicingTest.etree
439 lxml.tests.test_elementtree._XMLPullParserTest.etree
440 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-144', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-145" class="py-name"><a title="lxml.etree.ElementTree
441 xml.etree.ElementTree
442 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-145', 'ElementTree', 'link-5');">ElementTree</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
443 <a name="L160"></a><tt class="py-lineno">160</tt> <tt class="py-line"> <tt id="link-146" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-146', 'root', 'link-15');">root</a></tt> <tt class="py-op">=</tt> <tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-147" class="py-name"><a title="lxml.etree._ElementTree.parse
445 lxml.html.ElementSoup.parse
446 lxml.html.html5parser.parse
447 lxml.html.soupparser.parse
449 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-147', 'parse', 'link-124');">parse</a></tt><tt class="py-op">(</tt><tt id="link-148" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-148', 'filename', 'link-89');">filename</a></tt><tt class="py-op">)</tt> </tt>
450 <a name="L161"></a><tt class="py-lineno">161</tt> <tt class="py-line"> <tt class="py-comment"># and now do it again; previous content should still be there</tt> </tt>
451 <a name="L162"></a><tt class="py-lineno">162</tt> <tt class="py-line"> <tt class="py-name">root2</tt> <tt class="py-op">=</tt> <tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-149" class="py-name"><a title="lxml.etree._ElementTree.parse
453 lxml.html.ElementSoup.parse
454 lxml.html.html5parser.parse
455 lxml.html.soupparser.parse
457 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-149', 'parse', 'link-124');">parse</a></tt><tt class="py-op">(</tt><tt id="link-150" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-150', 'filename', 'link-89');">filename</a></tt><tt class="py-op">)</tt> </tt>
458 <a name="L163"></a><tt class="py-lineno">163</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-string">'a'</tt><tt class="py-op">,</tt> <tt id="link-151" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-151', 'root', 'link-15');">root</a></tt><tt class="py-op">.</tt><tt id="link-152" class="py-name" targets="Variable lxml.etree._Comment.tag=lxml.etree._Comment-class.html#tag,Variable lxml.etree._Element.tag=lxml.etree._Element-class.html#tag,Variable lxml.etree._Entity.tag=lxml.etree._Entity-class.html#tag,Variable lxml.etree._ProcessingInstruction.tag=lxml.etree._ProcessingInstruction-class.html#tag,Function lxml.tests.test_xpathevaluator.tag()=lxml.tests.test_xpathevaluator-module.html#tag,Variable xml.etree.ElementTree.Element.tag=xml.etree.ElementTree.Element-class.html#tag"><a title="lxml.etree._Comment.tag
459 lxml.etree._Element.tag
460 lxml.etree._Entity.tag
461 lxml.etree._ProcessingInstruction.tag
462 lxml.tests.test_xpathevaluator.tag
463 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-152', 'tag', 'link-152');">tag</a></tt><tt class="py-op">)</tt> </tt>
464 <a name="L164"></a><tt class="py-lineno">164</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-string">'a'</tt><tt class="py-op">,</tt> <tt class="py-name">root2</tt><tt class="py-op">.</tt><tt id="link-153" class="py-name"><a title="lxml.etree._Comment.tag
465 lxml.etree._Element.tag
466 lxml.etree._Entity.tag
467 lxml.etree._ProcessingInstruction.tag
468 lxml.tests.test_xpathevaluator.tag
469 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-153', 'tag', 'link-152');">tag</a></tt><tt class="py-op">)</tt> </tt>
470 <a name="L165"></a><tt class="py-lineno">165</tt> <tt class="py-line"> <tt class="py-comment"># now remove all references to root2, and parse again</tt> </tt>
471 <a name="L166"></a><tt class="py-lineno">166</tt> <tt class="py-line"> <tt class="py-keyword">del</tt> <tt class="py-name">root2</tt> </tt>
472 <a name="L167"></a><tt class="py-lineno">167</tt> <tt class="py-line"> <tt class="py-name">root3</tt> <tt class="py-op">=</tt> <tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-154" class="py-name"><a title="lxml.etree._ElementTree.parse
474 lxml.html.ElementSoup.parse
475 lxml.html.html5parser.parse
476 lxml.html.soupparser.parse
478 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-154', 'parse', 'link-124');">parse</a></tt><tt class="py-op">(</tt><tt id="link-155" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-155', 'filename', 'link-89');">filename</a></tt><tt class="py-op">)</tt> </tt>
479 <a name="L168"></a><tt class="py-lineno">168</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-string">'a'</tt><tt class="py-op">,</tt> <tt id="link-156" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-156', 'root', 'link-15');">root</a></tt><tt class="py-op">.</tt><tt id="link-157" class="py-name"><a title="lxml.etree._Comment.tag
480 lxml.etree._Element.tag
481 lxml.etree._Entity.tag
482 lxml.etree._ProcessingInstruction.tag
483 lxml.tests.test_xpathevaluator.tag
484 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-157', 'tag', 'link-152');">tag</a></tt><tt class="py-op">)</tt> </tt>
485 <a name="L169"></a><tt class="py-lineno">169</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-string">'a'</tt><tt class="py-op">,</tt> <tt class="py-name">root3</tt><tt class="py-op">.</tt><tt id="link-158" class="py-name"><a title="lxml.etree._Comment.tag
486 lxml.etree._Element.tag
487 lxml.etree._Entity.tag
488 lxml.etree._ProcessingInstruction.tag
489 lxml.tests.test_xpathevaluator.tag
490 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-158', 'tag', 'link-152');">tag</a></tt><tt class="py-op">)</tt> </tt>
491 </div><a name="L170"></a><tt class="py-lineno">170</tt> <tt class="py-line"> <tt class="py-comment"># root2's memory should've been freed here</tt> </tt>
492 <a name="L171"></a><tt class="py-lineno">171</tt> <tt class="py-line"> <tt class="py-comment"># XXX how to check?</tt> </tt>
493 <a name="L172"></a><tt class="py-lineno">172</tt> <tt class="py-line"> </tt>
494 <a name="_IOTestCaseBase.test_class_parse_fileobject"></a><div id="_IOTestCaseBase.test_class_parse_fileobject-def"><a name="L173"></a><tt class="py-lineno">173</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_class_parse_fileobject-toggle" onclick="return toggle('_IOTestCaseBase.test_class_parse_fileobject');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_class_parse_fileobject">test_class_parse_fileobject</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
495 </div><div id="_IOTestCaseBase.test_class_parse_fileobject-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_class_parse_fileobject-expanded"><a name="L174"></a><tt class="py-lineno">174</tt> <tt class="py-line"> <tt class="py-comment"># (c)ElementTree class ElementTree has a 'parse' method that returns</tt> </tt>
496 <a name="L175"></a><tt class="py-lineno">175</tt> <tt class="py-line"> <tt class="py-comment"># the root of the tree</tt> </tt>
497 <a name="L176"></a><tt class="py-lineno">176</tt> <tt class="py-line"> </tt>
498 <a name="L177"></a><tt class="py-lineno">177</tt> <tt class="py-line"> <tt class="py-comment"># parse from file object</tt> </tt>
499 <a name="L178"></a><tt class="py-lineno">178</tt> <tt class="py-line"> <tt id="link-159" class="py-name" targets="Method lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker.handle()=lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker-class.html#handle,Method lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndInjectWorker.handle()=lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndInjectWorker-class.html#handle,Method lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker.handle()=lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker-class.html#handle,Method lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker.handle()=lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker-class.html#handle,Method lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker.handle()=lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker-class.html#handle,Method lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker.handle()=lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker-class.html#handle,Method lxml.tests.test_threading.ThreadPipelineTestCase.Validate.handle()=lxml.tests.test_threading.ThreadPipelineTestCase.Validate-class.html#handle,Method lxml.tests.test_threading.ThreadPipelineTestCase.Worker.handle()=lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html#handle"><a title="lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker.handle
500 lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndInjectWorker.handle
501 lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker.handle
502 lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker.handle
503 lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker.handle
504 lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker.handle
505 lxml.tests.test_threading.ThreadPipelineTestCase.Validate.handle
506 lxml.tests.test_threading.ThreadPipelineTestCase.Worker.handle" class="py-name" href="#" onclick="return doclink('link-159', 'handle', 'link-159');">handle</a></tt><tt class="py-op">,</tt> <tt id="link-160" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-160', 'filename', 'link-89');">filename</a></tt> <tt class="py-op">=</tt> <tt class="py-name">tempfile</tt><tt class="py-op">.</tt><tt class="py-name">mkstemp</tt><tt class="py-op">(</tt><tt class="py-name">suffix</tt><tt class="py-op">=</tt><tt class="py-string">".xml"</tt><tt class="py-op">)</tt> </tt>
507 <a name="L179"></a><tt class="py-lineno">179</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
508 <a name="L180"></a><tt class="py-lineno">180</tt> <tt class="py-line"> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-161" class="py-name"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-161', 'write', 'link-49');">write</a></tt><tt class="py-op">(</tt><tt id="link-162" class="py-name"><a title="lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker.handle
509 lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndInjectWorker.handle
510 lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker.handle
511 lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker.handle
512 lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker.handle
513 lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker.handle
514 lxml.tests.test_threading.ThreadPipelineTestCase.Validate.handle
515 lxml.tests.test_threading.ThreadPipelineTestCase.Worker.handle" class="py-name" href="#" onclick="return doclink('link-162', 'handle', 'link-159');">handle</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">root_str</tt><tt class="py-op">)</tt> </tt>
516 <a name="L181"></a><tt class="py-lineno">181</tt> <tt class="py-line"> <tt class="py-keyword">with</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt id="link-163" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-163', 'filename', 'link-89');">filename</a></tt><tt class="py-op">,</tt> <tt class="py-string">'rb'</tt><tt class="py-op">)</tt> <tt class="py-keyword">as</tt> <tt class="py-name">f</tt><tt class="py-op">:</tt> </tt>
517 <a name="L182"></a><tt class="py-lineno">182</tt> <tt class="py-line"> <tt class="py-name">tree</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-164" class="py-name"><a title="lxml.etree
518 lxml.sax.ElementTreeContentHandler.etree
519 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
520 lxml.tests.test_elementtree.CElementTreeTestCase.etree
521 lxml.tests.test_elementtree._C14NTest.etree
522 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
523 lxml.tests.test_elementtree._ElementSlicingTest.etree
524 lxml.tests.test_elementtree._XMLPullParserTest.etree
525 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-164', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-165" class="py-name"><a title="lxml.etree.ElementTree
526 xml.etree.ElementTree
527 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-165', 'ElementTree', 'link-5');">ElementTree</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
528 <a name="L183"></a><tt class="py-lineno">183</tt> <tt class="py-line"> <tt id="link-166" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-166', 'root', 'link-15');">root</a></tt> <tt class="py-op">=</tt> <tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-167" class="py-name"><a title="lxml.etree._ElementTree.parse
530 lxml.html.ElementSoup.parse
531 lxml.html.html5parser.parse
532 lxml.html.soupparser.parse
534 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-167', 'parse', 'link-124');">parse</a></tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">)</tt> </tt>
535 <a name="L184"></a><tt class="py-lineno">184</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-168" class="py-name"><a title="lxml.etree
536 lxml.sax.ElementTreeContentHandler.etree
537 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
538 lxml.tests.test_elementtree.CElementTreeTestCase.etree
539 lxml.tests.test_elementtree._C14NTest.etree
540 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
541 lxml.tests.test_elementtree._ElementSlicingTest.etree
542 lxml.tests.test_elementtree._XMLPullParserTest.etree
543 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-168', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-169" class="py-name"><a title="lxml.etree.XSLT.tostring
544 lxml.etree.tostring" class="py-name" href="#" onclick="return doclink('link-169', 'tostring', 'link-19');">tostring</a></tt><tt class="py-op">(</tt><tt id="link-170" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-170', 'root', 'link-15');">root</a></tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">root_str</tt><tt class="py-op">)</tt> </tt>
545 <a name="L185"></a><tt class="py-lineno">185</tt> <tt class="py-line"> <tt class="py-keyword">finally</tt><tt class="py-op">:</tt> </tt>
546 <a name="L186"></a><tt class="py-lineno">186</tt> <tt class="py-line"> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-171" class="py-name" targets="Method lxml.etree.C14NWriterTarget.close()=lxml.etree.C14NWriterTarget-class.html#close,Method lxml.etree.TreeBuilder.close()=lxml.etree.TreeBuilder-class.html#close,Method lxml.etree._FeedParser.close()=lxml.etree._FeedParser-class.html#close,Method lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike.close()=lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike-class.html#close"><a title="lxml.etree.C14NWriterTarget.close
547 lxml.etree.TreeBuilder.close
548 lxml.etree._FeedParser.close
549 lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike.close" class="py-name" href="#" onclick="return doclink('link-171', 'close', 'link-171');">close</a></tt><tt class="py-op">(</tt><tt id="link-172" class="py-name"><a title="lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndExtendWorker.handle
550 lxml.tests.test_threading.ThreadPipelineTestCase.ParseAndInjectWorker.handle
551 lxml.tests.test_threading.ThreadPipelineTestCase.ParseWorker.handle
552 lxml.tests.test_threading.ThreadPipelineTestCase.ReverseWorker.handle
553 lxml.tests.test_threading.ThreadPipelineTestCase.RotateWorker.handle
554 lxml.tests.test_threading.ThreadPipelineTestCase.SerialiseWorker.handle
555 lxml.tests.test_threading.ThreadPipelineTestCase.Validate.handle
556 lxml.tests.test_threading.ThreadPipelineTestCase.Worker.handle" class="py-name" href="#" onclick="return doclink('link-172', 'handle', 'link-159');">handle</a></tt><tt class="py-op">)</tt> </tt>
557 <a name="L187"></a><tt class="py-lineno">187</tt> <tt class="py-line"> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-173" class="py-name" targets="Method lxml.etree._Element.remove()=lxml.etree._Element-class.html#remove,Method lxml.html.CheckboxValues.remove()=lxml.html.CheckboxValues-class.html#remove,Method lxml.html.Classes.remove()=lxml.html.Classes-class.html#remove,Method lxml.html.MultipleSelectOptions.remove()=lxml.html.MultipleSelectOptions-class.html#remove"><a title="lxml.etree._Element.remove
558 lxml.html.CheckboxValues.remove
559 lxml.html.Classes.remove
560 lxml.html.MultipleSelectOptions.remove" class="py-name" href="#" onclick="return doclink('link-173', 'remove', 'link-173');">remove</a></tt><tt class="py-op">(</tt><tt id="link-174" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-174', 'filename', 'link-89');">filename</a></tt><tt class="py-op">)</tt> </tt>
561 </div><a name="L188"></a><tt class="py-lineno">188</tt> <tt class="py-line"> </tt>
562 <a name="_IOTestCaseBase.test_class_parse_unamed_fileobject"></a><div id="_IOTestCaseBase.test_class_parse_unamed_fileobject-def"><a name="L189"></a><tt class="py-lineno">189</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_class_parse_unamed_fileobject-toggle" onclick="return toggle('_IOTestCaseBase.test_class_parse_unamed_fileobject');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_class_parse_unamed_fileobject">test_class_parse_unamed_fileobject</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
563 </div><div id="_IOTestCaseBase.test_class_parse_unamed_fileobject-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_class_parse_unamed_fileobject-expanded"><a name="L190"></a><tt class="py-lineno">190</tt> <tt class="py-line"> <tt class="py-comment"># (c)ElementTree class ElementTree has a 'parse' method that returns</tt> </tt>
564 <a name="L191"></a><tt class="py-lineno">191</tt> <tt class="py-line"> <tt class="py-comment"># the root of the tree</tt> </tt>
565 <a name="L192"></a><tt class="py-lineno">192</tt> <tt class="py-line"> </tt>
566 <a name="L193"></a><tt class="py-lineno">193</tt> <tt class="py-line"> <tt class="py-comment"># parse from unamed file object </tt> </tt>
567 <a name="L194"></a><tt class="py-lineno">194</tt> <tt class="py-line"> <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt id="link-175" class="py-name"><a title="lxml.tests.common_imports.SillyFileLike" class="py-name" href="#" onclick="return doclink('link-175', 'SillyFileLike', 'link-8');">SillyFileLike</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
568 <a name="L195"></a><tt class="py-lineno">195</tt> <tt class="py-line"> <tt id="link-176" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-176', 'root', 'link-15');">root</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-177" class="py-name"><a title="lxml.etree
569 lxml.sax.ElementTreeContentHandler.etree
570 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
571 lxml.tests.test_elementtree.CElementTreeTestCase.etree
572 lxml.tests.test_elementtree._C14NTest.etree
573 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
574 lxml.tests.test_elementtree._ElementSlicingTest.etree
575 lxml.tests.test_elementtree._XMLPullParserTest.etree
576 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-177', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-178" class="py-name"><a title="lxml.etree.ElementTree
577 xml.etree.ElementTree
578 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-178', 'ElementTree', 'link-5');">ElementTree</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-179" class="py-name"><a title="lxml.etree._ElementTree.parse
580 lxml.html.ElementSoup.parse
581 lxml.html.html5parser.parse
582 lxml.html.soupparser.parse
584 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-179', 'parse', 'link-124');">parse</a></tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">)</tt> </tt>
585 <a name="L196"></a><tt class="py-lineno">196</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertTrue</tt><tt class="py-op">(</tt><tt id="link-180" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-180', 'root', 'link-15');">root</a></tt><tt class="py-op">.</tt><tt id="link-181" class="py-name"><a title="lxml.etree._Comment.tag
586 lxml.etree._Element.tag
587 lxml.etree._Entity.tag
588 lxml.etree._ProcessingInstruction.tag
589 lxml.tests.test_xpathevaluator.tag
590 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-181', 'tag', 'link-152');">tag</a></tt><tt class="py-op">.</tt><tt class="py-name">endswith</tt><tt class="py-op">(</tt><tt class="py-string">'foo'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
591 </div><a name="L197"></a><tt class="py-lineno">197</tt> <tt class="py-line"> </tt>
592 <a name="_IOTestCaseBase.test_module_parse_large_fileobject"></a><div id="_IOTestCaseBase.test_module_parse_large_fileobject-def"><a name="L198"></a><tt class="py-lineno">198</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_module_parse_large_fileobject-toggle" onclick="return toggle('_IOTestCaseBase.test_module_parse_large_fileobject');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_module_parse_large_fileobject">test_module_parse_large_fileobject</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
593 </div><div id="_IOTestCaseBase.test_module_parse_large_fileobject-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_module_parse_large_fileobject-expanded"><a name="L199"></a><tt class="py-lineno">199</tt> <tt class="py-line"> <tt class="py-comment"># parse from unamed file object</tt> </tt>
594 <a name="L200"></a><tt class="py-lineno">200</tt> <tt class="py-line"> <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt id="link-182" class="py-name"><a title="lxml.tests.common_imports.LargeFileLike" class="py-name" href="#" onclick="return doclink('link-182', 'LargeFileLike', 'link-9');">LargeFileLike</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
595 <a name="L201"></a><tt class="py-lineno">201</tt> <tt class="py-line"> <tt class="py-name">tree</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-183" class="py-name"><a title="lxml.etree
596 lxml.sax.ElementTreeContentHandler.etree
597 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
598 lxml.tests.test_elementtree.CElementTreeTestCase.etree
599 lxml.tests.test_elementtree._C14NTest.etree
600 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
601 lxml.tests.test_elementtree._ElementSlicingTest.etree
602 lxml.tests.test_elementtree._XMLPullParserTest.etree
603 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-183', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-184" class="py-name"><a title="lxml.etree._ElementTree.parse
605 lxml.html.ElementSoup.parse
606 lxml.html.html5parser.parse
607 lxml.html.soupparser.parse
609 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-184', 'parse', 'link-124');">parse</a></tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">)</tt> </tt>
610 <a name="L202"></a><tt class="py-lineno">202</tt> <tt class="py-line"> <tt id="link-185" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-185', 'root', 'link-15');">root</a></tt> <tt class="py-op">=</tt> <tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-186" class="py-name"><a title="lxml.etree._ElementTree.getroot" class="py-name" href="#" onclick="return doclink('link-186', 'getroot', 'link-127');">getroot</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
611 <a name="L203"></a><tt class="py-lineno">203</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertTrue</tt><tt class="py-op">(</tt><tt id="link-187" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-187', 'root', 'link-15');">root</a></tt><tt class="py-op">.</tt><tt id="link-188" class="py-name"><a title="lxml.etree._Comment.tag
612 lxml.etree._Element.tag
613 lxml.etree._Entity.tag
614 lxml.etree._ProcessingInstruction.tag
615 lxml.tests.test_xpathevaluator.tag
616 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-188', 'tag', 'link-152');">tag</a></tt><tt class="py-op">.</tt><tt class="py-name">endswith</tt><tt class="py-op">(</tt><tt class="py-string">'root'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
617 </div><a name="L204"></a><tt class="py-lineno">204</tt> <tt class="py-line"> </tt>
618 <a name="_IOTestCaseBase.test_module_parse_fileobject_error"></a><div id="_IOTestCaseBase.test_module_parse_fileobject_error-def"><a name="L205"></a><tt class="py-lineno">205</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_module_parse_fileobject_error-toggle" onclick="return toggle('_IOTestCaseBase.test_module_parse_fileobject_error');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_module_parse_fileobject_error">test_module_parse_fileobject_error</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
619 </div><div id="_IOTestCaseBase.test_module_parse_fileobject_error-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_module_parse_fileobject_error-expanded"><a name="L206"></a><tt class="py-lineno">206</tt> <tt class="py-line"> <tt class="py-keyword">class</tt> <tt class="py-def-name">LocalError</tt><tt class="py-op">(</tt><tt class="py-base-class">Exception</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
620 <a name="L207"></a><tt class="py-lineno">207</tt> <tt class="py-line"> <tt class="py-keyword">pass</tt> </tt>
621 </div><a name="L208"></a><tt class="py-lineno">208</tt> <tt class="py-line"> <tt class="py-keyword">class</tt> <tt class="py-def-name">TestFile</tt><tt class="py-op">:</tt> </tt>
622 <a name="L209"></a><tt class="py-lineno">209</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">read</tt><tt class="py-op">(</tt><tt class="py-op">*</tt><tt class="py-param">args</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
623 <a name="L210"></a><tt class="py-lineno">210</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> <tt class="py-name">LocalError</tt> </tt>
624 </div></div><a name="L211"></a><tt class="py-lineno">211</tt> <tt class="py-line"> <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">TestFile</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
625 <a name="L212"></a><tt class="py-lineno">212</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">LocalError</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-189" class="py-name"><a title="lxml.etree
626 lxml.sax.ElementTreeContentHandler.etree
627 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
628 lxml.tests.test_elementtree.CElementTreeTestCase.etree
629 lxml.tests.test_elementtree._C14NTest.etree
630 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
631 lxml.tests.test_elementtree._ElementSlicingTest.etree
632 lxml.tests.test_elementtree._XMLPullParserTest.etree
633 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-189', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-190" class="py-name"><a title="lxml.etree._ElementTree.parse
635 lxml.html.ElementSoup.parse
636 lxml.html.html5parser.parse
637 lxml.html.soupparser.parse
639 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-190', 'parse', 'link-124');">parse</a></tt><tt class="py-op">,</tt> <tt class="py-name">f</tt><tt class="py-op">)</tt> </tt>
640 </div><a name="L213"></a><tt class="py-lineno">213</tt> <tt class="py-line"> </tt>
641 <a name="_IOTestCaseBase.test_module_parse_fileobject_late_error"></a><div id="_IOTestCaseBase.test_module_parse_fileobject_late_error-def"><a name="L214"></a><tt class="py-lineno">214</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_module_parse_fileobject_late_error-toggle" onclick="return toggle('_IOTestCaseBase.test_module_parse_fileobject_late_error');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_module_parse_fileobject_late_error">test_module_parse_fileobject_late_error</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
642 </div><div id="_IOTestCaseBase.test_module_parse_fileobject_late_error-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_module_parse_fileobject_late_error-expanded"><a name="L215"></a><tt class="py-lineno">215</tt> <tt class="py-line"> <tt class="py-keyword">class</tt> <tt class="py-def-name">LocalError</tt><tt class="py-op">(</tt><tt class="py-base-class">Exception</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
643 <a name="L216"></a><tt class="py-lineno">216</tt> <tt class="py-line"> <tt class="py-keyword">pass</tt> </tt>
644 </div><a name="L217"></a><tt class="py-lineno">217</tt> <tt class="py-line"> <tt class="py-keyword">class</tt> <tt class="py-def-name">TestFile</tt><tt class="py-op">:</tt> </tt>
645 <a name="L218"></a><tt class="py-lineno">218</tt> <tt class="py-line"> <tt id="link-191" class="py-name" targets="Method lxml.etree.C14NWriterTarget.data()=lxml.etree.C14NWriterTarget-class.html#data,Method lxml.etree.TreeBuilder.data()=lxml.etree.TreeBuilder-class.html#data"><a title="lxml.etree.C14NWriterTarget.data
646 lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-191', 'data', 'link-191');">data</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'<root>test</'</tt> </tt>
647 <a name="L219"></a><tt class="py-lineno">219</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
648 <a name="L220"></a><tt class="py-lineno">220</tt> <tt class="py-line"> <tt class="py-name">next_char</tt> <tt class="py-op">=</tt> <tt id="link-192" class="py-name" targets="Method lxml.etree._Element.iter()=lxml.etree._Element-class.html#iter,Method lxml.etree._ElementTree.iter()=lxml.etree._ElementTree-class.html#iter"><a title="lxml.etree._Element.iter
649 lxml.etree._ElementTree.iter" class="py-name" href="#" onclick="return doclink('link-192', 'iter', 'link-192');">iter</a></tt><tt class="py-op">(</tt><tt id="link-193" class="py-name"><a title="lxml.etree.C14NWriterTarget.data
650 lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-193', 'data', 'link-191');">data</a></tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-194" class="py-name" targets="Method lxml.etree.ElementDepthFirstIterator.next()=lxml.etree.ElementDepthFirstIterator-class.html#next,Method lxml.etree.ElementTextIterator.next()=lxml.etree.ElementTextIterator-class.html#next,Method lxml.etree._ElementIterator.next()=lxml.etree._ElementIterator-class.html#next,Method lxml.etree._ElementMatchIterator.next()=lxml.etree._ElementMatchIterator-class.html#next,Method lxml.etree.iterparse.next()=lxml.etree.iterparse-class.html#next,Method lxml.etree.iterwalk.next()=lxml.etree.iterwalk-class.html#next"><a title="lxml.etree.ElementDepthFirstIterator.next
651 lxml.etree.ElementTextIterator.next
652 lxml.etree._ElementIterator.next
653 lxml.etree._ElementMatchIterator.next
654 lxml.etree.iterparse.next
655 lxml.etree.iterwalk.next" class="py-name" href="#" onclick="return doclink('link-194', 'next', 'link-194');">next</a></tt> </tt>
656 <a name="L221"></a><tt class="py-lineno">221</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">AttributeError</tt><tt class="py-op">:</tt> </tt>
657 <a name="L222"></a><tt class="py-lineno">222</tt> <tt class="py-line"> <tt class="py-comment"># Python 3</tt> </tt>
658 <a name="L223"></a><tt class="py-lineno">223</tt> <tt class="py-line"> <tt class="py-name">next_char</tt> <tt class="py-op">=</tt> <tt id="link-195" class="py-name"><a title="lxml.etree._Element.iter
659 lxml.etree._ElementTree.iter" class="py-name" href="#" onclick="return doclink('link-195', 'iter', 'link-192');">iter</a></tt><tt class="py-op">(</tt><tt id="link-196" class="py-name"><a title="lxml.etree.C14NWriterTarget.data
660 lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-196', 'data', 'link-191');">data</a></tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-197" class="py-name" targets="Method lxml.etree.ElementDepthFirstIterator.__next__()=lxml.etree.ElementDepthFirstIterator-class.html#__next__,Method lxml.etree.ElementTextIterator.__next__()=lxml.etree.ElementTextIterator-class.html#__next__,Method lxml.etree._ElementIterator.__next__()=lxml.etree._ElementIterator-class.html#__next__,Method lxml.etree._ElementMatchIterator.__next__()=lxml.etree._ElementMatchIterator-class.html#__next__,Method lxml.etree.iterparse.__next__()=lxml.etree.iterparse-class.html#__next__,Method lxml.etree.iterwalk.__next__()=lxml.etree.iterwalk-class.html#__next__"><a title="lxml.etree.ElementDepthFirstIterator.__next__
661 lxml.etree.ElementTextIterator.__next__
662 lxml.etree._ElementIterator.__next__
663 lxml.etree._ElementMatchIterator.__next__
664 lxml.etree.iterparse.__next__
665 lxml.etree.iterwalk.__next__" class="py-name" href="#" onclick="return doclink('link-197', '__next__', 'link-197');">__next__</a></tt> </tt>
666 <a name="L224"></a><tt class="py-lineno">224</tt> <tt class="py-line"> <tt class="py-name">counter</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
667 <a name="L225"></a><tt class="py-lineno">225</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">read</tt><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">amount</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
668 <a name="L226"></a><tt class="py-lineno">226</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">amount</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
669 <a name="L227"></a><tt class="py-lineno">227</tt> <tt class="py-line"> <tt class="py-keyword">while</tt> <tt class="py-name">True</tt><tt class="py-op">:</tt> </tt>
670 <a name="L228"></a><tt class="py-lineno">228</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-198" class="py-name"><a title="lxml.tests.common_imports.LargeFileLike.read
671 lxml.tests.common_imports.SillyFileLike.read" class="py-name" href="#" onclick="return doclink('link-198', 'read', 'link-57');">read</a></tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
672 <a name="L229"></a><tt class="py-lineno">229</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
673 <a name="L230"></a><tt class="py-lineno">230</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
674 <a name="L231"></a><tt class="py-lineno">231</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">counter</tt> <tt class="py-op">+=</tt> <tt class="py-number">1</tt> </tt>
675 <a name="L232"></a><tt class="py-lineno">232</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt id="link-199" class="py-name"><a title="lxml.tests.common_imports._bytes" class="py-name" href="#" onclick="return doclink('link-199', '_bytes', 'link-7');">_bytes</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">next_char</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
676 <a name="L233"></a><tt class="py-lineno">233</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">StopIteration</tt><tt class="py-op">:</tt> </tt>
677 <a name="L234"></a><tt class="py-lineno">234</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> <tt class="py-name">LocalError</tt> </tt>
678 </div></div><a name="L235"></a><tt class="py-lineno">235</tt> <tt class="py-line"> <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">TestFile</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
679 <a name="L236"></a><tt class="py-lineno">236</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">LocalError</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-200" class="py-name"><a title="lxml.etree
680 lxml.sax.ElementTreeContentHandler.etree
681 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
682 lxml.tests.test_elementtree.CElementTreeTestCase.etree
683 lxml.tests.test_elementtree._C14NTest.etree
684 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
685 lxml.tests.test_elementtree._ElementSlicingTest.etree
686 lxml.tests.test_elementtree._XMLPullParserTest.etree
687 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-200', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-201" class="py-name"><a title="lxml.etree._ElementTree.parse
689 lxml.html.ElementSoup.parse
690 lxml.html.html5parser.parse
691 lxml.html.soupparser.parse
693 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-201', 'parse', 'link-124');">parse</a></tt><tt class="py-op">,</tt> <tt class="py-name">f</tt><tt class="py-op">)</tt> </tt>
694 <a name="L237"></a><tt class="py-lineno">237</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">.</tt><tt class="py-name">counter</tt><tt class="py-op">,</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-202" class="py-name"><a title="lxml.etree.C14NWriterTarget.data
695 lxml.etree.TreeBuilder.data" class="py-name" href="#" onclick="return doclink('link-202', 'data', 'link-191');">data</a></tt><tt class="py-op">)</tt><tt class="py-op">+</tt><tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
696 </div><a name="L238"></a><tt class="py-lineno">238</tt> <tt class="py-line"> </tt>
697 <a name="_IOTestCaseBase.test_module_parse_fileobject_type_error"></a><div id="_IOTestCaseBase.test_module_parse_fileobject_type_error-def"><a name="L239"></a><tt class="py-lineno">239</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_module_parse_fileobject_type_error-toggle" onclick="return toggle('_IOTestCaseBase.test_module_parse_fileobject_type_error');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_module_parse_fileobject_type_error">test_module_parse_fileobject_type_error</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
698 </div><div id="_IOTestCaseBase.test_module_parse_fileobject_type_error-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_module_parse_fileobject_type_error-expanded"><a name="L240"></a><tt class="py-lineno">240</tt> <tt class="py-line"> <tt class="py-keyword">class</tt> <tt class="py-def-name">TestFile</tt><tt class="py-op">:</tt> </tt>
699 <a name="L241"></a><tt class="py-lineno">241</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">read</tt><tt class="py-op">(</tt><tt class="py-op">*</tt><tt class="py-param">args</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
700 <a name="L242"></a><tt class="py-lineno">242</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-number">1</tt> </tt>
701 </div></div><a name="L243"></a><tt class="py-lineno">243</tt> <tt class="py-line"> <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">TestFile</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
702 <a name="L244"></a><tt class="py-lineno">244</tt> <tt class="py-line"> </tt>
703 <a name="L245"></a><tt class="py-lineno">245</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
704 <a name="L246"></a><tt class="py-lineno">246</tt> <tt class="py-line"> <tt class="py-name">expect_exc</tt> <tt class="py-op">=</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-203" class="py-name"><a title="lxml.etree
705 lxml.sax.ElementTreeContentHandler.etree
706 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
707 lxml.tests.test_elementtree.CElementTreeTestCase.etree
708 lxml.tests.test_elementtree._C14NTest.etree
709 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
710 lxml.tests.test_elementtree._ElementSlicingTest.etree
711 lxml.tests.test_elementtree._XMLPullParserTest.etree
712 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-203', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-204" class="py-name" targets="Class lxml.etree.ParseError=lxml.etree.ParseError-class.html,Class xml.etree.ElementTree.ParseError=xml.etree.ElementTree.ParseError-class.html"><a title="lxml.etree.ParseError
713 xml.etree.ElementTree.ParseError" class="py-name" href="#" onclick="return doclink('link-204', 'ParseError', 'link-204');">ParseError</a></tt><tt class="py-op">)</tt> </tt>
714 <a name="L247"></a><tt class="py-lineno">247</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">AttributeError</tt><tt class="py-op">:</tt> </tt>
715 <a name="L248"></a><tt class="py-lineno">248</tt> <tt class="py-line"> <tt class="py-name">expect_exc</tt> <tt class="py-op">=</tt> <tt class="py-name">TypeError</tt> </tt>
716 <a name="L249"></a><tt class="py-lineno">249</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">expect_exc</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-205" class="py-name"><a title="lxml.etree
717 lxml.sax.ElementTreeContentHandler.etree
718 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
719 lxml.tests.test_elementtree.CElementTreeTestCase.etree
720 lxml.tests.test_elementtree._C14NTest.etree
721 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
722 lxml.tests.test_elementtree._ElementSlicingTest.etree
723 lxml.tests.test_elementtree._XMLPullParserTest.etree
724 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-205', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-206" class="py-name"><a title="lxml.etree._ElementTree.parse
726 lxml.html.ElementSoup.parse
727 lxml.html.html5parser.parse
728 lxml.html.soupparser.parse
730 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-206', 'parse', 'link-124');">parse</a></tt><tt class="py-op">,</tt> <tt class="py-name">f</tt><tt class="py-op">)</tt> </tt>
731 </div><a name="L250"></a><tt class="py-lineno">250</tt> <tt class="py-line"> </tt>
732 <a name="_IOTestCaseBase.test_etree_parse_io_error"></a><div id="_IOTestCaseBase.test_etree_parse_io_error-def"><a name="L251"></a><tt class="py-lineno">251</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_etree_parse_io_error-toggle" onclick="return toggle('_IOTestCaseBase.test_etree_parse_io_error');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_etree_parse_io_error">test_etree_parse_io_error</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
733 </div><div id="_IOTestCaseBase.test_etree_parse_io_error-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_etree_parse_io_error-expanded"><a name="L252"></a><tt class="py-lineno">252</tt> <tt class="py-line"> <tt class="py-comment"># this is a directory name that contains characters beyond latin-1</tt> </tt>
734 <a name="L253"></a><tt class="py-lineno">253</tt> <tt class="py-line"> <tt class="py-name">dirnameEN</tt> <tt class="py-op">=</tt> <tt id="link-207" class="py-name"><a title="lxml.tests.common_imports._str" class="py-name" href="#" onclick="return doclink('link-207', '_str', 'link-6');">_str</a></tt><tt class="py-op">(</tt><tt class="py-string">'Directory'</tt><tt class="py-op">)</tt> </tt>
735 <a name="L254"></a><tt class="py-lineno">254</tt> <tt class="py-line"> <tt class="py-name">dirnameRU</tt> <tt class="py-op">=</tt> <tt id="link-208" class="py-name"><a title="lxml.tests.common_imports._str" class="py-name" href="#" onclick="return doclink('link-208', '_str', 'link-6');">_str</a></tt><tt class="py-op">(</tt><tt class="py-string">'Каталог'</tt><tt class="py-op">)</tt> </tt>
736 <a name="L255"></a><tt class="py-lineno">255</tt> <tt class="py-line"> <tt id="link-209" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-209', 'filename', 'link-89');">filename</a></tt> <tt class="py-op">=</tt> <tt id="link-210" class="py-name"><a title="lxml.tests.common_imports._str" class="py-name" href="#" onclick="return doclink('link-210', '_str', 'link-6');">_str</a></tt><tt class="py-op">(</tt><tt class="py-string">'nosuchfile.xml'</tt><tt class="py-op">)</tt> </tt>
737 <a name="L256"></a><tt class="py-lineno">256</tt> <tt class="py-line"> <tt class="py-name">dn</tt> <tt class="py-op">=</tt> <tt class="py-name">tempfile</tt><tt class="py-op">.</tt><tt class="py-name">mkdtemp</tt><tt class="py-op">(</tt><tt id="link-211" class="py-name"><a title="lxml.etree._Element.prefix" class="py-name" href="#" onclick="return doclink('link-211', 'prefix', 'link-88');">prefix</a></tt><tt class="py-op">=</tt><tt class="py-name">dirnameEN</tt><tt class="py-op">)</tt> </tt>
738 <a name="L257"></a><tt class="py-lineno">257</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
739 <a name="L258"></a><tt class="py-lineno">258</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">IOError</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-212" class="py-name"><a title="lxml.etree
740 lxml.sax.ElementTreeContentHandler.etree
741 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
742 lxml.tests.test_elementtree.CElementTreeTestCase.etree
743 lxml.tests.test_elementtree._C14NTest.etree
744 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
745 lxml.tests.test_elementtree._ElementSlicingTest.etree
746 lxml.tests.test_elementtree._XMLPullParserTest.etree
747 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-212', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-213" class="py-name"><a title="lxml.etree._ElementTree.parse
749 lxml.html.ElementSoup.parse
750 lxml.html.html5parser.parse
751 lxml.html.soupparser.parse
753 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-213', 'parse', 'link-124');">parse</a></tt><tt class="py-op">,</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-214" class="py-name"><a title="lxml.etree.XPath.path
754 lxml.etree._LogEntry.path" class="py-name" href="#" onclick="return doclink('link-214', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">dn</tt><tt class="py-op">,</tt> <tt id="link-215" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-215', 'filename', 'link-89');">filename</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
755 <a name="L259"></a><tt class="py-lineno">259</tt> <tt class="py-line"> <tt class="py-keyword">finally</tt><tt class="py-op">:</tt> </tt>
756 <a name="L260"></a><tt class="py-lineno">260</tt> <tt class="py-line"> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">rmdir</tt><tt class="py-op">(</tt><tt class="py-name">dn</tt><tt class="py-op">)</tt> </tt>
757 <a name="L261"></a><tt class="py-lineno">261</tt> <tt class="py-line"> <tt class="py-name">dn</tt> <tt class="py-op">=</tt> <tt class="py-name">tempfile</tt><tt class="py-op">.</tt><tt class="py-name">mkdtemp</tt><tt class="py-op">(</tt><tt id="link-216" class="py-name"><a title="lxml.etree._Element.prefix" class="py-name" href="#" onclick="return doclink('link-216', 'prefix', 'link-88');">prefix</a></tt><tt class="py-op">=</tt><tt class="py-name">dirnameRU</tt><tt class="py-op">)</tt> </tt>
758 <a name="L262"></a><tt class="py-lineno">262</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
759 <a name="L263"></a><tt class="py-lineno">263</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">IOError</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-217" class="py-name"><a title="lxml.etree
760 lxml.sax.ElementTreeContentHandler.etree
761 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
762 lxml.tests.test_elementtree.CElementTreeTestCase.etree
763 lxml.tests.test_elementtree._C14NTest.etree
764 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
765 lxml.tests.test_elementtree._ElementSlicingTest.etree
766 lxml.tests.test_elementtree._XMLPullParserTest.etree
767 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-217', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-218" class="py-name"><a title="lxml.etree._ElementTree.parse
769 lxml.html.ElementSoup.parse
770 lxml.html.html5parser.parse
771 lxml.html.soupparser.parse
773 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-218', 'parse', 'link-124');">parse</a></tt><tt class="py-op">,</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-219" class="py-name"><a title="lxml.etree.XPath.path
774 lxml.etree._LogEntry.path" class="py-name" href="#" onclick="return doclink('link-219', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">dn</tt><tt class="py-op">,</tt> <tt id="link-220" class="py-name"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-220', 'filename', 'link-89');">filename</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
775 <a name="L264"></a><tt class="py-lineno">264</tt> <tt class="py-line"> <tt class="py-keyword">finally</tt><tt class="py-op">:</tt> </tt>
776 <a name="L265"></a><tt class="py-lineno">265</tt> <tt class="py-line"> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">rmdir</tt><tt class="py-op">(</tt><tt class="py-name">dn</tt><tt class="py-op">)</tt> </tt>
777 </div><a name="L266"></a><tt class="py-lineno">266</tt> <tt class="py-line"> </tt>
778 <a name="_IOTestCaseBase.test_parse_utf8_bom"></a><div id="_IOTestCaseBase.test_parse_utf8_bom-def"><a name="L267"></a><tt class="py-lineno">267</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_parse_utf8_bom-toggle" onclick="return toggle('_IOTestCaseBase.test_parse_utf8_bom');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_parse_utf8_bom">test_parse_utf8_bom</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
779 </div><div id="_IOTestCaseBase.test_parse_utf8_bom-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_parse_utf8_bom-expanded"><a name="L268"></a><tt class="py-lineno">268</tt> <tt class="py-line"> <tt class="py-name">utext</tt> <tt class="py-op">=</tt> <tt id="link-221" class="py-name"><a title="lxml.tests.common_imports._str" class="py-name" href="#" onclick="return doclink('link-221', '_str', 'link-6');">_str</a></tt><tt class="py-op">(</tt><tt class="py-string">'Søk på nettet'</tt><tt class="py-op">)</tt> </tt>
780 <a name="L269"></a><tt class="py-lineno">269</tt> <tt class="py-line"> <tt id="link-222" class="py-name" targets="Variable lxml.tests.test_unicode.uxml=lxml.tests.test_unicode-module.html#uxml"><a title="lxml.tests.test_unicode.uxml" class="py-name" href="#" onclick="return doclink('link-222', 'uxml', 'link-222');">uxml</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'<?xml version="1.0" encoding="UTF-8"?><p>%s</p>'</tt> <tt class="py-op">%</tt> <tt class="py-name">utext</tt> </tt>
781 <a name="L270"></a><tt class="py-lineno">270</tt> <tt class="py-line"> <tt class="py-name">bom</tt> <tt class="py-op">=</tt> <tt id="link-223" class="py-name"><a title="lxml.tests.common_imports._bytes" class="py-name" href="#" onclick="return doclink('link-223', '_bytes', 'link-7');">_bytes</a></tt><tt class="py-op">(</tt><tt class="py-string">'\\xEF\\xBB\\xBF'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">decode</tt><tt class="py-op">(</tt> </tt>
782 <a name="L271"></a><tt class="py-lineno">271</tt> <tt class="py-line"> <tt class="py-string">"unicode_escape"</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">"latin1"</tt><tt class="py-op">)</tt> </tt>
783 <a name="L272"></a><tt class="py-lineno">272</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-number">3</tt><tt class="py-op">,</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">bom</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
784 <a name="L273"></a><tt class="py-lineno">273</tt> <tt class="py-line"> <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">tempfile</tt><tt class="py-op">.</tt><tt class="py-name">NamedTemporaryFile</tt><tt class="py-op">(</tt><tt class="py-name">delete</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt> </tt>
785 <a name="L274"></a><tt class="py-lineno">274</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
786 <a name="L275"></a><tt class="py-lineno">275</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
787 <a name="L276"></a><tt class="py-lineno">276</tt> <tt class="py-line"> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-224" class="py-name"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-224', 'write', 'link-49');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">bom</tt><tt class="py-op">)</tt> </tt>
788 <a name="L277"></a><tt class="py-lineno">277</tt> <tt class="py-line"> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-225" class="py-name"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-225', 'write', 'link-49');">write</a></tt><tt class="py-op">(</tt><tt id="link-226" class="py-name"><a title="lxml.tests.test_unicode.uxml" class="py-name" href="#" onclick="return doclink('link-226', 'uxml', 'link-222');">uxml</a></tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">"utf-8"</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
789 <a name="L278"></a><tt class="py-lineno">278</tt> <tt class="py-line"> <tt class="py-keyword">finally</tt><tt class="py-op">:</tt> </tt>
790 <a name="L279"></a><tt class="py-lineno">279</tt> <tt class="py-line"> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-227" class="py-name"><a title="lxml.etree.C14NWriterTarget.close
791 lxml.etree.TreeBuilder.close
792 lxml.etree._FeedParser.close
793 lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike.close" class="py-name" href="#" onclick="return doclink('link-227', 'close', 'link-171');">close</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
794 <a name="L280"></a><tt class="py-lineno">280</tt> <tt class="py-line"> <tt class="py-name">tree</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-228" class="py-name"><a title="lxml.etree
795 lxml.sax.ElementTreeContentHandler.etree
796 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
797 lxml.tests.test_elementtree.CElementTreeTestCase.etree
798 lxml.tests.test_elementtree._C14NTest.etree
799 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
800 lxml.tests.test_elementtree._ElementSlicingTest.etree
801 lxml.tests.test_elementtree._XMLPullParserTest.etree
802 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-228', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-229" class="py-name"><a title="lxml.etree._ElementTree.parse
804 lxml.html.ElementSoup.parse
805 lxml.html.html5parser.parse
806 lxml.html.soupparser.parse
808 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-229', 'parse', 'link-124');">parse</a></tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-230" class="py-name"><a title="lxml.etree.DTD.name
809 lxml.etree._Entity.name
810 lxml.html.InputMixin.name
811 lxml.objectify.PyType.name" class="py-name" href="#" onclick="return doclink('link-230', 'name', 'link-25');">name</a></tt><tt class="py-op">)</tt> </tt>
812 <a name="L281"></a><tt class="py-lineno">281</tt> <tt class="py-line"> <tt class="py-keyword">finally</tt><tt class="py-op">:</tt> </tt>
813 <a name="L282"></a><tt class="py-lineno">282</tt> <tt class="py-line"> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">unlink</tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-231" class="py-name"><a title="lxml.etree.DTD.name
814 lxml.etree._Entity.name
815 lxml.html.InputMixin.name
816 lxml.objectify.PyType.name" class="py-name" href="#" onclick="return doclink('link-231', 'name', 'link-25');">name</a></tt><tt class="py-op">)</tt> </tt>
817 <a name="L283"></a><tt class="py-lineno">283</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-name">utext</tt><tt class="py-op">,</tt> <tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-232" class="py-name"><a title="lxml.etree._ElementTree.getroot" class="py-name" href="#" onclick="return doclink('link-232', 'getroot', 'link-127');">getroot</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-233" class="py-name"><a title="lxml.etree.QName.text
818 lxml.etree._Element.text
819 lxml.etree._Entity.text
820 lxml.objectify.ObjectifiedElement.text
821 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-233', 'text', 'link-42');">text</a></tt><tt class="py-op">)</tt> </tt>
822 </div><a name="L284"></a><tt class="py-lineno">284</tt> <tt class="py-line"> </tt>
823 <a name="_IOTestCaseBase.test_iterparse_utf8_bom"></a><div id="_IOTestCaseBase.test_iterparse_utf8_bom-def"><a name="L285"></a><tt class="py-lineno">285</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_iterparse_utf8_bom-toggle" onclick="return toggle('_IOTestCaseBase.test_iterparse_utf8_bom');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_iterparse_utf8_bom">test_iterparse_utf8_bom</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
824 </div><div id="_IOTestCaseBase.test_iterparse_utf8_bom-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_iterparse_utf8_bom-expanded"><a name="L286"></a><tt class="py-lineno">286</tt> <tt class="py-line"> <tt class="py-name">utext</tt> <tt class="py-op">=</tt> <tt id="link-234" class="py-name"><a title="lxml.tests.common_imports._str" class="py-name" href="#" onclick="return doclink('link-234', '_str', 'link-6');">_str</a></tt><tt class="py-op">(</tt><tt class="py-string">'Søk på nettet'</tt><tt class="py-op">)</tt> </tt>
825 <a name="L287"></a><tt class="py-lineno">287</tt> <tt class="py-line"> <tt id="link-235" class="py-name"><a title="lxml.tests.test_unicode.uxml" class="py-name" href="#" onclick="return doclink('link-235', 'uxml', 'link-222');">uxml</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'<?xml version="1.0" encoding="UTF-8"?><p>%s</p>'</tt> <tt class="py-op">%</tt> <tt class="py-name">utext</tt> </tt>
826 <a name="L288"></a><tt class="py-lineno">288</tt> <tt class="py-line"> <tt class="py-name">bom</tt> <tt class="py-op">=</tt> <tt id="link-236" class="py-name"><a title="lxml.tests.common_imports._bytes" class="py-name" href="#" onclick="return doclink('link-236', '_bytes', 'link-7');">_bytes</a></tt><tt class="py-op">(</tt><tt class="py-string">'\\xEF\\xBB\\xBF'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">decode</tt><tt class="py-op">(</tt> </tt>
827 <a name="L289"></a><tt class="py-lineno">289</tt> <tt class="py-line"> <tt class="py-string">"unicode_escape"</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">"latin1"</tt><tt class="py-op">)</tt> </tt>
828 <a name="L290"></a><tt class="py-lineno">290</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-number">3</tt><tt class="py-op">,</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">bom</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
829 <a name="L291"></a><tt class="py-lineno">291</tt> <tt class="py-line"> <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">tempfile</tt><tt class="py-op">.</tt><tt class="py-name">NamedTemporaryFile</tt><tt class="py-op">(</tt><tt class="py-name">delete</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt> </tt>
830 <a name="L292"></a><tt class="py-lineno">292</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
831 <a name="L293"></a><tt class="py-lineno">293</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
832 <a name="L294"></a><tt class="py-lineno">294</tt> <tt class="py-line"> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-237" class="py-name"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-237', 'write', 'link-49');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">bom</tt><tt class="py-op">)</tt> </tt>
833 <a name="L295"></a><tt class="py-lineno">295</tt> <tt class="py-line"> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-238" class="py-name"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-238', 'write', 'link-49');">write</a></tt><tt class="py-op">(</tt><tt id="link-239" class="py-name"><a title="lxml.tests.test_unicode.uxml" class="py-name" href="#" onclick="return doclink('link-239', 'uxml', 'link-222');">uxml</a></tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">"utf-8"</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
834 <a name="L296"></a><tt class="py-lineno">296</tt> <tt class="py-line"> <tt class="py-keyword">finally</tt><tt class="py-op">:</tt> </tt>
835 <a name="L297"></a><tt class="py-lineno">297</tt> <tt class="py-line"> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-240" class="py-name"><a title="lxml.etree.C14NWriterTarget.close
836 lxml.etree.TreeBuilder.close
837 lxml.etree._FeedParser.close
838 lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike.close" class="py-name" href="#" onclick="return doclink('link-240', 'close', 'link-171');">close</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
839 <a name="L298"></a><tt class="py-lineno">298</tt> <tt class="py-line"> <tt id="link-241" class="py-name" targets="Method lxml.etree.DTD.elements()=lxml.etree.DTD-class.html#elements"><a title="lxml.etree.DTD.elements" class="py-name" href="#" onclick="return doclink('link-241', 'elements', 'link-241');">elements</a></tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-name">el</tt> <tt class="py-keyword">for</tt> <tt class="py-name">_</tt><tt class="py-op">,</tt> <tt class="py-name">el</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-242" class="py-name"><a title="lxml.etree
840 lxml.sax.ElementTreeContentHandler.etree
841 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
842 lxml.tests.test_elementtree.CElementTreeTestCase.etree
843 lxml.tests.test_elementtree._C14NTest.etree
844 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
845 lxml.tests.test_elementtree._ElementSlicingTest.etree
846 lxml.tests.test_elementtree._XMLPullParserTest.etree
847 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-242', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-243" class="py-name" targets="Class lxml.etree.iterparse=lxml.etree.iterparse-class.html,Function lxml.tests.selftest.iterparse()=lxml.tests.selftest-module.html#iterparse"><a title="lxml.etree.iterparse
848 lxml.tests.selftest.iterparse" class="py-name" href="#" onclick="return doclink('link-243', 'iterparse', 'link-243');">iterparse</a></tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-244" class="py-name"><a title="lxml.etree.DTD.name
849 lxml.etree._Entity.name
850 lxml.html.InputMixin.name
851 lxml.objectify.PyType.name" class="py-name" href="#" onclick="return doclink('link-244', 'name', 'link-25');">name</a></tt><tt class="py-op">)</tt><tt class="py-op">]</tt> </tt>
852 <a name="L299"></a><tt class="py-lineno">299</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">,</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt id="link-245" class="py-name"><a title="lxml.etree.DTD.elements" class="py-name" href="#" onclick="return doclink('link-245', 'elements', 'link-241');">elements</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
853 <a name="L300"></a><tt class="py-lineno">300</tt> <tt class="py-line"> <tt id="link-246" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-246', 'root', 'link-15');">root</a></tt> <tt class="py-op">=</tt> <tt id="link-247" class="py-name"><a title="lxml.etree.DTD.elements" class="py-name" href="#" onclick="return doclink('link-247', 'elements', 'link-241');">elements</a></tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
854 <a name="L301"></a><tt class="py-lineno">301</tt> <tt class="py-line"> <tt class="py-keyword">finally</tt><tt class="py-op">:</tt> </tt>
855 <a name="L302"></a><tt class="py-lineno">302</tt> <tt class="py-line"> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">unlink</tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-248" class="py-name"><a title="lxml.etree.DTD.name
856 lxml.etree._Entity.name
857 lxml.html.InputMixin.name
858 lxml.objectify.PyType.name" class="py-name" href="#" onclick="return doclink('link-248', 'name', 'link-25');">name</a></tt><tt class="py-op">)</tt> </tt>
859 <a name="L303"></a><tt class="py-lineno">303</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-name">utext</tt><tt class="py-op">,</tt> <tt id="link-249" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-249', 'root', 'link-15');">root</a></tt><tt class="py-op">.</tt><tt id="link-250" class="py-name"><a title="lxml.etree.QName.text
860 lxml.etree._Element.text
861 lxml.etree._Entity.text
862 lxml.objectify.ObjectifiedElement.text
863 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-250', 'text', 'link-42');">text</a></tt><tt class="py-op">)</tt> </tt>
864 </div><a name="L304"></a><tt class="py-lineno">304</tt> <tt class="py-line"> </tt>
865 <a name="_IOTestCaseBase.test_iterparse_utf16_bom"></a><div id="_IOTestCaseBase.test_iterparse_utf16_bom-def"><a name="L305"></a><tt class="py-lineno">305</tt> <a class="py-toggle" href="#" id="_IOTestCaseBase.test_iterparse_utf16_bom-toggle" onclick="return toggle('_IOTestCaseBase.test_iterparse_utf16_bom');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io._IOTestCaseBase-class.html#test_iterparse_utf16_bom">test_iterparse_utf16_bom</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
866 </div><div id="_IOTestCaseBase.test_iterparse_utf16_bom-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_IOTestCaseBase.test_iterparse_utf16_bom-expanded"><a name="L306"></a><tt class="py-lineno">306</tt> <tt class="py-line"> <tt class="py-name">utext</tt> <tt class="py-op">=</tt> <tt id="link-251" class="py-name"><a title="lxml.tests.common_imports._str" class="py-name" href="#" onclick="return doclink('link-251', '_str', 'link-6');">_str</a></tt><tt class="py-op">(</tt><tt class="py-string">'Søk på nettet'</tt><tt class="py-op">)</tt> </tt>
867 <a name="L307"></a><tt class="py-lineno">307</tt> <tt class="py-line"> <tt id="link-252" class="py-name"><a title="lxml.tests.test_unicode.uxml" class="py-name" href="#" onclick="return doclink('link-252', 'uxml', 'link-222');">uxml</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'<?xml version="1.0" encoding="UTF-16"?><p>%s</p>'</tt> <tt class="py-op">%</tt> <tt class="py-name">utext</tt> </tt>
868 <a name="L308"></a><tt class="py-lineno">308</tt> <tt class="py-line"> <tt class="py-name">boms</tt> <tt class="py-op">=</tt> <tt id="link-253" class="py-name"><a title="lxml.tests.common_imports._bytes" class="py-name" href="#" onclick="return doclink('link-253', '_bytes', 'link-7');">_bytes</a></tt><tt class="py-op">(</tt><tt class="py-string">'\\xFE\\xFF \\xFF\\xFE'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">decode</tt><tt class="py-op">(</tt> </tt>
869 <a name="L309"></a><tt class="py-lineno">309</tt> <tt class="py-line"> <tt class="py-string">"unicode_escape"</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">"latin1"</tt><tt class="py-op">)</tt> </tt>
870 <a name="L310"></a><tt class="py-lineno">310</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-number">5</tt><tt class="py-op">,</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">boms</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
871 <a name="L311"></a><tt class="py-lineno">311</tt> <tt class="py-line"> <tt id="link-254" class="py-name" targets="Variable lxml.tests.test_threading.ThreadPipelineTestCase.xml=lxml.tests.test_threading.ThreadPipelineTestCase-class.html#xml"><a title="lxml.tests.test_threading.ThreadPipelineTestCase.xml" class="py-name" href="#" onclick="return doclink('link-254', 'xml', 'link-254');">xml</a></tt> <tt class="py-op">=</tt> <tt id="link-255" class="py-name"><a title="lxml.tests.test_unicode.uxml" class="py-name" href="#" onclick="return doclink('link-255', 'uxml', 'link-222');">uxml</a></tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">"utf-16"</tt><tt class="py-op">)</tt> </tt>
872 <a name="L312"></a><tt class="py-lineno">312</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertTrue</tt><tt class="py-op">(</tt><tt id="link-256" class="py-name"><a title="lxml.tests.test_threading.ThreadPipelineTestCase.xml" class="py-name" href="#" onclick="return doclink('link-256', 'xml', 'link-254');">xml</a></tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-number">2</tt><tt class="py-op">]</tt> <tt class="py-keyword">in</tt> <tt class="py-name">boms</tt><tt class="py-op">,</tt> <tt class="py-name">repr</tt><tt class="py-op">(</tt><tt id="link-257" class="py-name"><a title="lxml.tests.test_threading.ThreadPipelineTestCase.xml" class="py-name" href="#" onclick="return doclink('link-257', 'xml', 'link-254');">xml</a></tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-number">2</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
873 <a name="L313"></a><tt class="py-lineno">313</tt> <tt class="py-line"> </tt>
874 <a name="L314"></a><tt class="py-lineno">314</tt> <tt class="py-line"> <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">tempfile</tt><tt class="py-op">.</tt><tt class="py-name">NamedTemporaryFile</tt><tt class="py-op">(</tt><tt class="py-name">delete</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt> </tt>
875 <a name="L315"></a><tt class="py-lineno">315</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
876 <a name="L316"></a><tt class="py-lineno">316</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
877 <a name="L317"></a><tt class="py-lineno">317</tt> <tt class="py-line"> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-258" class="py-name"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-258', 'write', 'link-49');">write</a></tt><tt class="py-op">(</tt><tt id="link-259" class="py-name"><a title="lxml.tests.test_threading.ThreadPipelineTestCase.xml" class="py-name" href="#" onclick="return doclink('link-259', 'xml', 'link-254');">xml</a></tt><tt class="py-op">)</tt> </tt>
878 <a name="L318"></a><tt class="py-lineno">318</tt> <tt class="py-line"> <tt class="py-keyword">finally</tt><tt class="py-op">:</tt> </tt>
879 <a name="L319"></a><tt class="py-lineno">319</tt> <tt class="py-line"> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-260" class="py-name"><a title="lxml.etree.C14NWriterTarget.close
880 lxml.etree.TreeBuilder.close
881 lxml.etree._FeedParser.close
882 lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike.close" class="py-name" href="#" onclick="return doclink('link-260', 'close', 'link-171');">close</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
883 <a name="L320"></a><tt class="py-lineno">320</tt> <tt class="py-line"> <tt id="link-261" class="py-name"><a title="lxml.etree.DTD.elements" class="py-name" href="#" onclick="return doclink('link-261', 'elements', 'link-241');">elements</a></tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-name">el</tt> <tt class="py-keyword">for</tt> <tt class="py-name">_</tt><tt class="py-op">,</tt> <tt class="py-name">el</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-262" class="py-name"><a title="lxml.etree
884 lxml.sax.ElementTreeContentHandler.etree
885 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
886 lxml.tests.test_elementtree.CElementTreeTestCase.etree
887 lxml.tests.test_elementtree._C14NTest.etree
888 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
889 lxml.tests.test_elementtree._ElementSlicingTest.etree
890 lxml.tests.test_elementtree._XMLPullParserTest.etree
891 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-262', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-263" class="py-name"><a title="lxml.etree.iterparse
892 lxml.tests.selftest.iterparse" class="py-name" href="#" onclick="return doclink('link-263', 'iterparse', 'link-243');">iterparse</a></tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-264" class="py-name"><a title="lxml.etree.DTD.name
893 lxml.etree._Entity.name
894 lxml.html.InputMixin.name
895 lxml.objectify.PyType.name" class="py-name" href="#" onclick="return doclink('link-264', 'name', 'link-25');">name</a></tt><tt class="py-op">)</tt><tt class="py-op">]</tt> </tt>
896 <a name="L321"></a><tt class="py-lineno">321</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">,</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt id="link-265" class="py-name"><a title="lxml.etree.DTD.elements" class="py-name" href="#" onclick="return doclink('link-265', 'elements', 'link-241');">elements</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
897 <a name="L322"></a><tt class="py-lineno">322</tt> <tt class="py-line"> <tt id="link-266" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-266', 'root', 'link-15');">root</a></tt> <tt class="py-op">=</tt> <tt id="link-267" class="py-name"><a title="lxml.etree.DTD.elements" class="py-name" href="#" onclick="return doclink('link-267', 'elements', 'link-241');">elements</a></tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
898 <a name="L323"></a><tt class="py-lineno">323</tt> <tt class="py-line"> <tt class="py-keyword">finally</tt><tt class="py-op">:</tt> </tt>
899 <a name="L324"></a><tt class="py-lineno">324</tt> <tt class="py-line"> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt class="py-name">unlink</tt><tt class="py-op">(</tt><tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-268" class="py-name"><a title="lxml.etree.DTD.name
900 lxml.etree._Entity.name
901 lxml.html.InputMixin.name
902 lxml.objectify.PyType.name" class="py-name" href="#" onclick="return doclink('link-268', 'name', 'link-25');">name</a></tt><tt class="py-op">)</tt> </tt>
903 <a name="L325"></a><tt class="py-lineno">325</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt class="py-name">utext</tt><tt class="py-op">,</tt> <tt id="link-269" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-269', 'root', 'link-15');">root</a></tt><tt class="py-op">.</tt><tt id="link-270" class="py-name"><a title="lxml.etree.QName.text
904 lxml.etree._Element.text
905 lxml.etree._Entity.text
906 lxml.objectify.ObjectifiedElement.text
907 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-270', 'text', 'link-42');">text</a></tt><tt class="py-op">)</tt> </tt>
908 </div></div><a name="L326"></a><tt class="py-lineno">326</tt> <tt class="py-line"> </tt>
909 <a name="L327"></a><tt class="py-lineno">327</tt> <tt class="py-line"> </tt>
910 <a name="ETreeIOTestCase"></a><div id="ETreeIOTestCase-def"><a name="L328"></a><tt class="py-lineno">328</tt> <a class="py-toggle" href="#" id="ETreeIOTestCase-toggle" onclick="return toggle('ETreeIOTestCase');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lxml.tests.test_io.ETreeIOTestCase-class.html">ETreeIOTestCase</a><tt class="py-op">(</tt><tt class="py-base-class">_IOTestCaseBase</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
911 </div><div id="ETreeIOTestCase-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="ETreeIOTestCase-expanded"><a name="L329"></a><tt class="py-lineno">329</tt> <tt class="py-line"> <tt id="link-271" class="py-name"><a title="lxml.etree
912 lxml.sax.ElementTreeContentHandler.etree
913 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
914 lxml.tests.test_elementtree.CElementTreeTestCase.etree
915 lxml.tests.test_elementtree._C14NTest.etree
916 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
917 lxml.tests.test_elementtree._ElementSlicingTest.etree
918 lxml.tests.test_elementtree._XMLPullParserTest.etree
919 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-271', 'etree', 'link-4');">etree</a></tt> <tt class="py-op">=</tt> <tt id="link-272" class="py-name"><a title="lxml.etree
920 lxml.sax.ElementTreeContentHandler.etree
921 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
922 lxml.tests.test_elementtree.CElementTreeTestCase.etree
923 lxml.tests.test_elementtree._C14NTest.etree
924 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
925 lxml.tests.test_elementtree._ElementSlicingTest.etree
926 lxml.tests.test_elementtree._XMLPullParserTest.etree
927 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-272', 'etree', 'link-4');">etree</a></tt> </tt>
928 <a name="L330"></a><tt class="py-lineno">330</tt> <tt class="py-line"> </tt>
929 <a name="ETreeIOTestCase.test_write_compressed_text"></a><div id="ETreeIOTestCase.test_write_compressed_text-def"><a name="L331"></a><tt class="py-lineno">331</tt> <a class="py-toggle" href="#" id="ETreeIOTestCase.test_write_compressed_text-toggle" onclick="return toggle('ETreeIOTestCase.test_write_compressed_text');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.tests.test_io.ETreeIOTestCase-class.html#test_write_compressed_text">test_write_compressed_text</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
930 </div><div id="ETreeIOTestCase.test_write_compressed_text-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ETreeIOTestCase.test_write_compressed_text-expanded"><a name="L332"></a><tt class="py-lineno">332</tt> <tt class="py-line"> <tt id="link-273" class="py-name"><a title="lxml.etree.Element
931 lxml.objectify.Element
932 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
933 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-273', 'Element', 'link-17');">Element</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-274" class="py-name"><a title="lxml.etree
934 lxml.sax.ElementTreeContentHandler.etree
935 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
936 lxml.tests.test_elementtree.CElementTreeTestCase.etree
937 lxml.tests.test_elementtree._C14NTest.etree
938 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
939 lxml.tests.test_elementtree._ElementSlicingTest.etree
940 lxml.tests.test_elementtree._XMLPullParserTest.etree
941 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-274', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-275" class="py-name"><a title="lxml.etree.Element
942 lxml.objectify.Element
943 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
944 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-275', 'Element', 'link-17');">Element</a></tt> </tt>
945 <a name="L333"></a><tt class="py-lineno">333</tt> <tt class="py-line"> <tt id="link-276" class="py-name" targets="Function lxml.etree.SubElement()=lxml.etree-module.html#SubElement"><a title="lxml.etree.SubElement" class="py-name" href="#" onclick="return doclink('link-276', 'SubElement', 'link-276');">SubElement</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-277" class="py-name"><a title="lxml.etree
946 lxml.sax.ElementTreeContentHandler.etree
947 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
948 lxml.tests.test_elementtree.CElementTreeTestCase.etree
949 lxml.tests.test_elementtree._C14NTest.etree
950 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
951 lxml.tests.test_elementtree._ElementSlicingTest.etree
952 lxml.tests.test_elementtree._XMLPullParserTest.etree
953 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-277', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-278" class="py-name"><a title="lxml.etree.SubElement" class="py-name" href="#" onclick="return doclink('link-278', 'SubElement', 'link-276');">SubElement</a></tt> </tt>
954 <a name="L334"></a><tt class="py-lineno">334</tt> <tt class="py-line"> <tt id="link-279" class="py-name"><a title="lxml.etree.ElementTree
955 xml.etree.ElementTree
956 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-279', 'ElementTree', 'link-5');">ElementTree</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-280" class="py-name"><a title="lxml.etree
957 lxml.sax.ElementTreeContentHandler.etree
958 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
959 lxml.tests.test_elementtree.CElementTreeTestCase.etree
960 lxml.tests.test_elementtree._C14NTest.etree
961 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
962 lxml.tests.test_elementtree._ElementSlicingTest.etree
963 lxml.tests.test_elementtree._XMLPullParserTest.etree
964 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-280', 'etree', 'link-4');">etree</a></tt><tt class="py-op">.</tt><tt id="link-281" class="py-name"><a title="lxml.etree.ElementTree
965 xml.etree.ElementTree
966 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-281', 'ElementTree', 'link-5');">ElementTree</a></tt> </tt>
967 <a name="L335"></a><tt class="py-lineno">335</tt> <tt class="py-line"> <tt id="link-282" class="py-name"><a title="lxml.etree.QName.text
968 lxml.etree._Element.text
969 lxml.etree._Entity.text
970 lxml.objectify.ObjectifiedElement.text
971 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-282', 'text', 'link-42');">text</a></tt> <tt class="py-op">=</tt> <tt id="link-283" class="py-name"><a title="lxml.tests.common_imports._str" class="py-name" href="#" onclick="return doclink('link-283', '_str', 'link-6');">_str</a></tt><tt class="py-op">(</tt><tt class="py-string">"qwrtioüöä"</tt><tt class="py-op">)</tt> </tt>
972 <a name="L336"></a><tt class="py-lineno">336</tt> <tt class="py-line"> </tt>
973 <a name="L337"></a><tt class="py-lineno">337</tt> <tt class="py-line"> <tt id="link-284" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-284', 'root', 'link-15');">root</a></tt> <tt class="py-op">=</tt> <tt id="link-285" class="py-name"><a title="lxml.etree.Element
974 lxml.objectify.Element
975 lxml.tests.test_pyclasslookup.PyClassLookupTestCase.Element
976 xml.etree.ElementTree.Element" class="py-name" href="#" onclick="return doclink('link-285', 'Element', 'link-17');">Element</a></tt><tt class="py-op">(</tt><tt class="py-string">'root'</tt><tt class="py-op">)</tt> </tt>
977 <a name="L338"></a><tt class="py-lineno">338</tt> <tt class="py-line"> <tt id="link-286" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-286', 'root', 'link-15');">root</a></tt><tt class="py-op">.</tt><tt id="link-287" class="py-name"><a title="lxml.etree.QName.text
978 lxml.etree._Element.text
979 lxml.etree._Entity.text
980 lxml.objectify.ObjectifiedElement.text
981 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-287', 'text', 'link-42');">text</a></tt> <tt class="py-op">=</tt> <tt id="link-288" class="py-name"><a title="lxml.etree.QName.text
982 lxml.etree._Element.text
983 lxml.etree._Entity.text
984 lxml.objectify.ObjectifiedElement.text
985 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-288', 'text', 'link-42');">text</a></tt> </tt>
986 <a name="L339"></a><tt class="py-lineno">339</tt> <tt class="py-line"> <tt class="py-name">child</tt> <tt class="py-op">=</tt> <tt id="link-289" class="py-name"><a title="lxml.etree.SubElement" class="py-name" href="#" onclick="return doclink('link-289', 'SubElement', 'link-276');">SubElement</a></tt><tt class="py-op">(</tt><tt id="link-290" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-290', 'root', 'link-15');">root</a></tt><tt class="py-op">,</tt> <tt class="py-string">'sub'</tt><tt class="py-op">)</tt> </tt>
987 <a name="L340"></a><tt class="py-lineno">340</tt> <tt class="py-line"> <tt class="py-name">child</tt><tt class="py-op">.</tt><tt id="link-291" class="py-name"><a title="lxml.etree.QName.text
988 lxml.etree._Element.text
989 lxml.etree._Entity.text
990 lxml.objectify.ObjectifiedElement.text
991 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-291', 'text', 'link-42');">text</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'TEXT'</tt> </tt>
992 <a name="L341"></a><tt class="py-lineno">341</tt> <tt class="py-line"> <tt class="py-name">child</tt><tt class="py-op">.</tt><tt id="link-292" class="py-name" targets="Variable lxml.etree._Element.tail=lxml.etree._Element-class.html#tail,Variable xml.etree.ElementTree.Element.tail=xml.etree.ElementTree.Element-class.html#tail"><a title="lxml.etree._Element.tail
993 xml.etree.ElementTree.Element.tail" class="py-name" href="#" onclick="return doclink('link-292', 'tail', 'link-292');">tail</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'TAIL'</tt> </tt>
994 <a name="L342"></a><tt class="py-lineno">342</tt> <tt class="py-line"> <tt id="link-293" class="py-name"><a title="lxml.etree.SubElement" class="py-name" href="#" onclick="return doclink('link-293', 'SubElement', 'link-276');">SubElement</a></tt><tt class="py-op">(</tt><tt id="link-294" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-294', 'root', 'link-15');">root</a></tt><tt class="py-op">,</tt> <tt class="py-string">'sub'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-295" class="py-name"><a title="lxml.etree.QName.text
995 lxml.etree._Element.text
996 lxml.etree._Entity.text
997 lxml.objectify.ObjectifiedElement.text
998 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-295', 'text', 'link-42');">text</a></tt> <tt class="py-op">=</tt> <tt id="link-296" class="py-name"><a title="lxml.etree.QName.text
999 lxml.etree._Element.text
1000 lxml.etree._Entity.text
1001 lxml.objectify.ObjectifiedElement.text
1002 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-296', 'text', 'link-42');">text</a></tt> </tt>
1003 <a name="L343"></a><tt class="py-lineno">343</tt> <tt class="py-line"> </tt>
1004 <a name="L344"></a><tt class="py-lineno">344</tt> <tt class="py-line"> <tt class="py-name">tree</tt> <tt class="py-op">=</tt> <tt id="link-297" class="py-name"><a title="lxml.etree.ElementTree
1005 xml.etree.ElementTree
1006 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-297', 'ElementTree', 'link-5');">ElementTree</a></tt><tt class="py-op">(</tt><tt id="link-298" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-298', 'root', 'link-15');">root</a></tt><tt class="py-op">)</tt> </tt>
1007 <a name="L345"></a><tt class="py-lineno">345</tt> <tt class="py-line"> <tt class="py-name">out</tt> <tt class="py-op">=</tt> <tt class="py-name">BytesIO</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
1008 <a name="L346"></a><tt class="py-lineno">346</tt> <tt class="py-line"> <tt class="py-name">tree</tt><tt class="py-op">.</tt><tt id="link-299" class="py-name"><a title="lxml.etree._ElementTree.write" class="py-name" href="#" onclick="return doclink('link-299', 'write', 'link-49');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">out</tt><tt class="py-op">,</tt> <tt id="link-300" class="py-name" targets="Variable lxml.html.FormElement.method=lxml.html.FormElement-class.html#method"><a title="lxml.html.FormElement.method" class="py-name" href="#" onclick="return doclink('link-300', 'method', 'link-300');">method</a></tt><tt class="py-op">=</tt><tt class="py-string">'text'</tt><tt class="py-op">,</tt> <tt id="link-301" class="py-name"><a title="lxml.etree.DocInfo.encoding
1009 lxml.tests.selftest.encoding
1010 lxml.tests.selftest2.encoding" class="py-name" href="#" onclick="return doclink('link-301', 'encoding', 'link-50');">encoding</a></tt><tt class="py-op">=</tt><tt class="py-string">'utf8'</tt><tt class="py-op">,</tt> <tt class="py-name">compression</tt><tt class="py-op">=</tt><tt class="py-number">9</tt><tt class="py-op">)</tt> </tt>
1011 <a name="L347"></a><tt class="py-lineno">347</tt> <tt class="py-line"> <tt class="py-name">out</tt><tt class="py-op">.</tt><tt class="py-name">seek</tt><tt class="py-op">(</tt><tt class="py-number">0</tt><tt class="py-op">)</tt> </tt>
1012 <a name="L348"></a><tt class="py-lineno">348</tt> <tt class="py-line"> </tt>
1013 <a name="L349"></a><tt class="py-lineno">349</tt> <tt class="py-line"> <tt class="py-name">f</tt> <tt class="py-op">=</tt> <tt class="py-name">gzip</tt><tt class="py-op">.</tt><tt class="py-name">GzipFile</tt><tt class="py-op">(</tt><tt class="py-name">fileobj</tt><tt class="py-op">=</tt><tt class="py-name">out</tt><tt class="py-op">)</tt> </tt>
1014 <a name="L350"></a><tt class="py-lineno">350</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
1015 <a name="L351"></a><tt class="py-lineno">351</tt> <tt class="py-line"> <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-302" class="py-name"><a title="lxml.tests.common_imports.LargeFileLike.read
1016 lxml.tests.common_imports.SillyFileLike.read" class="py-name" href="#" onclick="return doclink('link-302', 'read', 'link-57');">read</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">decode</tt><tt class="py-op">(</tt><tt class="py-string">'utf8'</tt><tt class="py-op">)</tt> </tt>
1017 <a name="L352"></a><tt class="py-lineno">352</tt> <tt class="py-line"> <tt class="py-keyword">finally</tt><tt class="py-op">:</tt> </tt>
1018 <a name="L353"></a><tt class="py-lineno">353</tt> <tt class="py-line"> <tt class="py-name">f</tt><tt class="py-op">.</tt><tt id="link-303" class="py-name"><a title="lxml.etree.C14NWriterTarget.close
1019 lxml.etree.TreeBuilder.close
1020 lxml.etree._FeedParser.close
1021 lxml.tests.test_incremental_xmlfile.SimpleFileLikeXmlFileTestCase.SimpleFileLike.close" class="py-name" href="#" onclick="return doclink('link-303', 'close', 'link-171');">close</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
1022 <a name="L354"></a><tt class="py-lineno">354</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">assertEqual</tt><tt class="py-op">(</tt><tt id="link-304" class="py-name"><a title="lxml.etree.QName.text
1023 lxml.etree._Element.text
1024 lxml.etree._Entity.text
1025 lxml.objectify.ObjectifiedElement.text
1026 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-304', 'text', 'link-42');">text</a></tt><tt class="py-op">+</tt><tt class="py-string">'TEXTTAIL'</tt><tt class="py-op">+</tt><tt id="link-305" class="py-name"><a title="lxml.etree.QName.text
1027 lxml.etree._Element.text
1028 lxml.etree._Entity.text
1029 lxml.objectify.ObjectifiedElement.text
1030 xml.etree.ElementTree.Element.text" class="py-name" href="#" onclick="return doclink('link-305', 'text', 'link-42');">text</a></tt><tt class="py-op">,</tt> <tt class="py-name">result</tt><tt class="py-op">)</tt> </tt>
1031 </div></div><a name="L355"></a><tt class="py-lineno">355</tt> <tt class="py-line"> </tt>
1032 <a name="L356"></a><tt class="py-lineno">356</tt> <tt class="py-line"> </tt>
1033 <a name="L357"></a><tt class="py-lineno">357</tt> <tt class="py-line"><tt class="py-keyword">if</tt> <tt id="link-306" class="py-name"><a title="lxml.etree.ElementTree
1034 xml.etree.ElementTree
1035 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-306', 'ElementTree', 'link-5');">ElementTree</a></tt><tt class="py-op">:</tt> </tt>
1036 <a name="ElementTreeIOTestCase"></a><div id="ElementTreeIOTestCase-def"><a name="L358"></a><tt class="py-lineno">358</tt> <a class="py-toggle" href="#" id="ElementTreeIOTestCase-toggle" onclick="return toggle('ElementTreeIOTestCase');">-</a><tt class="py-line"> <tt class="py-keyword">class</tt> <a class="py-def-name" href="lxml.tests.test_io.ElementTreeIOTestCase-class.html">ElementTreeIOTestCase</a><tt class="py-op">(</tt><tt class="py-base-class">_IOTestCaseBase</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
1037 </div><div id="ElementTreeIOTestCase-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ElementTreeIOTestCase-expanded"><a name="L359"></a><tt class="py-lineno">359</tt> <tt class="py-line"> <tt id="link-307" class="py-name"><a title="lxml.etree
1038 lxml.sax.ElementTreeContentHandler.etree
1039 lxml.tests.test_elementtree.CElementTreeElementSlicingTest.etree
1040 lxml.tests.test_elementtree.CElementTreeTestCase.etree
1041 lxml.tests.test_elementtree._C14NTest.etree
1042 lxml.tests.test_elementtree._ETreeTestCaseBase.etree
1043 lxml.tests.test_elementtree._ElementSlicingTest.etree
1044 lxml.tests.test_elementtree._XMLPullParserTest.etree
1045 lxml.tests.test_io._IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-307', 'etree', 'link-4');">etree</a></tt> <tt class="py-op">=</tt> <tt id="link-308" class="py-name"><a title="lxml.etree.ElementTree
1046 xml.etree.ElementTree
1047 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-308', 'ElementTree', 'link-5');">ElementTree</a></tt> </tt>
1048 </div><a name="L360"></a><tt class="py-lineno">360</tt> <tt class="py-line"> </tt>
1049 <a name="L361"></a><tt class="py-lineno">361</tt> <tt class="py-line"> </tt>
1050 <a name="test_suite"></a><div id="test_suite-def"><a name="L362"></a><tt class="py-lineno">362</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_io-module.html#test_suite">test_suite</a><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
1051 </div><div id="test_suite-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="test_suite-expanded"><a name="L363"></a><tt class="py-lineno">363</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>
1052 <a name="L364"></a><tt class="py-lineno">364</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-309" class="py-name" targets="Class lxml.tests.test_io.ETreeIOTestCase=lxml.tests.test_io.ETreeIOTestCase-class.html"><a title="lxml.tests.test_io.ETreeIOTestCase" class="py-name" href="#" onclick="return doclink('link-309', 'ETreeIOTestCase', 'link-309');">ETreeIOTestCase</a></tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
1053 <a name="L365"></a><tt class="py-lineno">365</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt id="link-310" class="py-name"><a title="lxml.etree.ElementTree
1054 xml.etree.ElementTree
1055 xml.etree.ElementTree.ElementTree" class="py-name" href="#" onclick="return doclink('link-310', 'ElementTree', 'link-5');">ElementTree</a></tt><tt class="py-op">:</tt> </tt>
1056 <a name="L366"></a><tt class="py-lineno">366</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-311" class="py-name" targets="Class lxml.tests.test_io.ElementTreeIOTestCase=lxml.tests.test_io.ElementTreeIOTestCase-class.html"><a title="lxml.tests.test_io.ElementTreeIOTestCase" class="py-name" href="#" onclick="return doclink('link-311', 'ElementTreeIOTestCase', 'link-311');">ElementTreeIOTestCase</a></tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
1057 <a name="L367"></a><tt class="py-lineno">367</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">suite</tt> </tt>
1058 </div><a name="L368"></a><tt class="py-lineno">368</tt> <tt class="py-line"> </tt>
1059 <a name="L369"></a><tt class="py-lineno">369</tt> <tt class="py-line"> </tt>
1060 <a name="L370"></a><tt class="py-lineno">370</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>
1061 <a name="L371"></a><tt class="py-lineno">371</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>
1062 <a name="L372"></a><tt class="py-lineno">372</tt> <tt class="py-line"> </tt><script type="text/javascript">
1064 expandto(location.href);
1069 <!-- ==================== NAVIGATION BAR ==================== -->
1070 <table class="navbar" border="0" width="100%" cellpadding="0"
1071 bgcolor="#a0c0ff" cellspacing="0">
1072 <tr valign="middle">
1074 <th> <a
1075 href="lxml-module.html">Home</a> </th>
1078 <th> <a
1079 href="module-tree.html">Trees</a> </th>
1082 <th> <a
1083 href="identifier-index.html">Indices</a> </th>
1086 <th> <a
1087 href="help.html">Help</a> </th>
1089 <!-- Project homepage -->
1090 <th class="navbar" align="right" width="100%">
1091 <table border="0" cellpadding="0" cellspacing="0">
1092 <tr><th class="navbar" align="center"
1093 ><a class="navbar" target="_top" href="/">lxml API</a></th>
1097 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
1099 <td align="left" class="footer">
1100 Generated by Epydoc 3.0.1
1101 on Wed Jan 29 12:26:21 2020
1103 <td align="right" class="footer">
1104 <a target="mainFrame" href="http://epydoc.sourceforge.net"
1105 >http://epydoc.sourceforge.net</a>
1110 <script type="text/javascript">
1112 // Private objects are initially displayed (because if
1113 // javascript is turned off then we want them to be
1114 // visible); but by default, we want to hide them. So hide
1115 // them unless we have a cookie that says to show them.