Example #1
0
 def test_insert(self):
     contents = ('<Element attr="attrValue"><Subnode>testValue</Subnode>'
                 '</Element>')
     root = Node('root')
     root2 = root.insert(contents)
     element = root2.node('Element')
     rawElement = Node.create(contents)
     self.assertEqual(element.xml(), rawElement.xml())
Example #2
0
 def test_insert(self):
     contents = ('<Element attr="attrValue"><Subnode>testValue</Subnode>'
                 '</Element>')
     root = Node('root')
     root2 = root.insert(contents)
     element = root2.node('Element')
     rawElement = Node.create(contents)
     self.assertEqual(element.xml(), rawElement.xml())
Example #3
0
 def test_create(self):
     test_file_element = os.path.join(ntd.test_data_path,
                                      'some_xml_file.xml')
     fileElement = Node.create(test_file_element)
     with open(test_file_element, 'r') as myfile:
         contents = myfile.read().replace('\n', '')
     root = Node('root')
     root = root.insert(contents)
     rawElement = root.children[0]
     self.assertEqual(fileElement.xml(), rawElement.xml())
Example #4
0
 def test_create(self):
     test_file_element = os.path.join(ntd.test_data_path,
                                      'some_xml_file.xml')
     fileElement = Node.create(test_file_element)
     with open(test_file_element, 'r') as myfile:
         contents = myfile.read().replace('\n', '')
     root = Node('root')
     root = root.insert(contents)
     rawElement = root.children[0]
     self.assertEqual(fileElement.xml(), rawElement.xml())