MCPcopy Index your code
hub / github.com/python/cpython / test_custom_builder_only_end_ns

Method test_custom_builder_only_end_ns

Lib/test/test_xml_etree.py:689–709  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

687 ])
688
689 def test_custom_builder_only_end_ns(self):
690 class Builder(list):
691 def end_ns(self, prefix):
692 self.append(("end-ns", prefix))
693
694 builder = Builder()
695 parser = ET.XMLParser(target=builder)
696 parser.feed(textwrap.dedent("""\
697 <?pi data?>
698 <!-- comment -->
699 <root xmlns='namespace' xmlns:p='pns' xmlns:a='ans'>
700 <a:element key='value'>text</a:element>
701 <p:element>text</p:element>tail
702 <empty-element/>
703 </root>
704 """))
705 self.assertEqual(builder, [
706 ('end-ns', 'a'),
707 ('end-ns', 'p'),
708 ('end-ns', ''),
709 ])
710
711 def test_initialize_parser_without_target(self):
712 # Explicit None

Callers

nothing calls this directly

Calls 4

feedMethod · 0.95
BuilderClass · 0.70
dedentMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected