Ejemplo n.º 1
0
 def setup(self):
     xml = etree.Element('root')
     xml.set('attr1', 'val1')
     xml.set('attr2', 'val2')
     etree.SubElement(xml, 'node1')
     etree.SubElement(xml, 'node2')
     self.node = mappet.Node(xml)
Ejemplo n.º 2
0
 def test__repr__no_attributes(self):
     xml = etree.Element('root')
     etree.SubElement(xml, 'node1')
     etree.SubElement(xml, 'node2')
     node = mappet.Node(xml)
     # A node without attributes, with children, should have the number of
     # children shown in parentheses, without the ending '/>'.
     assert repr(node) == '<root> (2)'
Ejemplo n.º 3
0
 def test__repr__no_children(self):
     xml = etree.Element('root')
     xml.set('attr1', 'val1')
     node = mappet.Node(xml)
     assert repr(node) == '<root attr1="val1"/> (0)'