<s> from __future__ import absolute_import , division , unicode_literals <EOL> import io <EOL> from . import support <EOL> from html5lib import html5parser <EOL> from html5lib . constants import namespaces <EOL> from html5lib import treebuilders <EOL> import unittest <EOL> class MoreParserTests ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . dom_tree = treebuilders . getTreeBuilder ( "<STR_LIT>" ) <EOL> def test_assertDoctypeCloneable ( self ) : <EOL> parser = html5parser . HTMLParser ( tree = self . dom_tree ) <EOL> doc = parser . parse ( '<STR_LIT>' ) <EOL> self . assertTrue ( doc . cloneNode ( True ) ) <EOL> def test_line_counter ( self ) : <EOL> parser = html5parser . HTMLParser ( tree = self . dom_tree ) <EOL> parser . parse ( "<STR_LIT>" ) <EOL> def test_namespace_html_elements_0_dom ( self ) : <EOL> parser = html5parser . HTMLParser ( tree = self . dom_tree , namespaceHTMLElements = True ) <EOL> doc = parser . parse ( "<STR_LIT>" ) <EOL> self . assertTrue ( doc . childNodes [ <NUM_LIT:0> ] . namespaceURI == namespaces [ "<STR_LIT:html>" ] ) <EOL> def test_namespace_html_elements_1_dom ( self ) : <EOL> parser = html5parser . HTMLParser ( tree = self . dom_tree , namespaceHTMLElements = False ) <EOL> doc = parser . parse ( "<STR_LIT>" ) <EOL> self . assertTrue ( doc . childNodes [ <NUM_LIT:0> ] . namespaceURI is None ) <EOL> def test_namespace_html_elements_0_etree ( self ) : <EOL> parser = html5parser . HTMLParser ( namespaceHTMLElements = True ) <EOL> doc = parser . parse ( "<STR_LIT>" ) <EOL> self . assertTrue ( doc . tag == "<STR_LIT>" % ( namespaces [ "<STR_LIT:html>" ] , ) ) <EOL> def test_namespace_html_elements_1_etree ( self ) : <EOL> parser = html5parser . HTMLParser ( namespaceHTMLElements = False ) <EOL> doc = parser . parse ( "<STR_LIT>" ) <EOL> self . assertTrue ( doc . tag == "<STR_LIT:html>" ) <EOL> def test_unicode_file ( self ) : <EOL> parser = html5parser . HTMLParser ( ) <EOL> parser . parse ( io . StringIO ( "<STR_LIT:a>" ) ) <EOL> def buildTestSuite ( ) : <EOL> return unittest . defaultTestLoader . loadTestsFromName ( __name__ ) <EOL> def main ( ) : <EOL> buildTestSuite ( ) <EOL> unittest . main ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
