def test_lxml_namespaced_attributes(self):
     lxml_elt = DOM_LXML.create_tag("svg")
     DOM_LXML.append_child(
         lxml_elt, DOM_LXML.create_tag("use", {"xlink:href": "test"}))
     self.assertEqual(
         DOM_LXML.render_debug(lxml_elt),
         '<svg><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="test"></use></svg>',
     )
 def test_lxml_self_closing_tags(self):
     self.assertEqual(DOM_LXML.render_debug(DOM_LXML.create_tag("hr")),
                      "<hr>")
Exemplo n.º 3
0
 def test_lxml_html_escaping(self):
     self.assertEqual(
         DOM_LXML.render_debug(
             DOM_LXML.create_tag('img', {
                 'alt': '< " \' < > &',
             })), '<img alt="&lt; &quot; \' &lt; &gt; &amp;">')
Exemplo n.º 4
0
 def test_lxml_invalid_attributes(self):
     with self.assertRaises(ValueError):
         DOM_LXML.render_debug(
             DOM_LXML.create_tag('div', {'*ngFor': 'test'}))
Exemplo n.º 5
0
 def test_append_child(self):
     parent = DOM_LXML.create_tag('p')
     DOM_LXML.append_child(parent, DOM_LXML.create_tag('span', {}))
     self.assertEqual(DOM_LXML.render_debug(parent), '<p><span></span></p>')
Exemplo n.º 6
0
 def test_append_child(self):
     parent = DOM_LXML.create_tag("p")
     DOM_LXML.append_child(parent, DOM_LXML.create_tag("span", {}))
     self.assertEqual(DOM_LXML.render_debug(parent), "<p><span></span></p>")
Exemplo n.º 7
0
 def test_create_tag_empty(self):
     self.assertEqual(DOM_LXML.render_debug(DOM_LXML.create_tag("p")),
                      "<p></p>")
 def test_lxml_html_escaping(self):
     self.assertEqual(
         DOM_LXML.render_debug(
             DOM_LXML.create_tag("img", {"alt": "< \" ' < > &"})),
         '<img alt="&lt; &quot; \' &lt; &gt; &amp;">',
     )
 def test_create_tag_empty(self):
     self.assertEqual(DOM_LXML.render_debug(DOM_LXML.create_tag('p')), '<p></p>')
 def test_lxml_html_parsing(self):
     self.assertEqual(DOM_LXML.render_debug(DOM_LXML.parse_html('<p>Invalid > " &</p>')), '<p>Invalid &gt; " &amp;</p>')
 def test_lxml_html_escaping(self):
     self.assertEqual(DOM_LXML.render_debug(DOM_LXML.create_tag('img', {
         'alt': '< " \' < > &',
     })), '<img alt="&lt; &quot; \' &lt; &gt; &amp;">')
 def test_lxml_namespaced_attributes(self):
     lxml_elt = DOM_LXML.create_tag('svg')
     DOM_LXML.append_child(lxml_elt, DOM_LXML.create_tag('use', {'xlink:href': 'test'}))
     self.assertEqual(DOM_LXML.render_debug(lxml_elt), '<svg><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="test"></use></svg>')
 def test_lxml_invalid_attributes(self):
     with self.assertRaises(ValueError):
         DOM_LXML.render_debug(DOM_LXML.create_tag('div', {'*ngFor': 'test'}))
 def test_lxml_self_closing_tags(self):
     self.assertEqual(DOM_LXML.render_debug(DOM_LXML.create_tag('hr')), '<hr>')
Exemplo n.º 15
0
 def test_create_tag(self):
     self.assertEqual(
         DOM_LXML.render_debug(DOM_LXML.create_tag('p',
                                                   {'class': 'intro'})),
         '<p class="intro"></p>')
 def test_lxml_invalid_attributes(self):
     with self.assertRaises(ValueError):
         DOM_LXML.render_debug(
             DOM_LXML.create_tag("div", {"*ngFor": "test"}))
 def test_parse_html(self):
     self.assertEqual(DOM_LXML.render_debug(DOM_LXML.parse_html('<p><span>Test text</span></p>')), '<p><span>Test text</span></p>')
 def test_append_child(self):
     parent = DOM_LXML.create_tag('p')
     DOM_LXML.append_child(parent, DOM_LXML.create_tag('span', {}))
     self.assertEqual(DOM_LXML.render_debug(parent), '<p><span></span></p>')
 def test_lxml_html_parsing(self):
     self.assertEqual(
         DOM_LXML.render_debug(DOM_LXML.parse_html('<p>Invalid > " &</p>')),
         '<p>Invalid &gt; " &amp;</p>',
     )
 def test_create_tag(self):
     self.assertEqual(DOM_LXML.render_debug(DOM_LXML.create_tag('p', {'class': 'intro'})), '<p class="intro"></p>')
Exemplo n.º 21
0
 def test_parse_html(self):
     self.assertEqual(
         DOM_LXML.render_debug(
             DOM_LXML.parse_html("<p><span>Test text</span></p>")),
         "<p><span>Test text</span></p>",
     )
Exemplo n.º 22
0
 def test_lxml_self_closing_tags(self):
     self.assertEqual(DOM_LXML.render_debug(DOM_LXML.create_tag('hr')),
                      '<hr>')
Exemplo n.º 23
0
 def test_create_tag(self):
     self.assertEqual(
         DOM_LXML.render_debug(DOM_LXML.create_tag("p",
                                                   {"class": "intro"})),
         '<p class="intro"></p>',
     )
Exemplo n.º 24
0
 def test_create_tag_empty(self):
     self.assertEqual(DOM_LXML.render_debug(DOM_LXML.create_tag('p')),
                      '<p></p>')