Esempio n. 1
0
 def test_remove_namespaces_on_namespaceless_xml(self):
     xml = b'<?xml version="1.0"?><one><two><three/><three/></two></one>'
     expected = '<one><two><three/><three/></two></one>'
     result = xml_remove_namespaces(xml)
     assert isinstance(result, bytes)
     result = remove_whitespace(result.decode('utf-8'))
     self.assertEqual(result, expected)
Esempio n. 2
0
 def test_remove_namespaces_on_namespaceless_xml(self):
     xml = b'<?xml version="1.0"?><one><two><three/><three/></two></one>'
     expected = '<one><two><three/><three/></two></one>'
     result = xml_remove_namespaces(xml)
     assert isinstance(result, bytes)
     result = remove_whitespace(result.decode('utf-8'))
     self.assertEqual(result, expected)
Esempio n. 3
0
 def test_remove_namespaces(self):
     xml = b'''<?xml version="1.0"?>
         <w:one xmlns:w="foo">
             <w:two>
                 <w:three/>
                 <w:three/>
             </w:two>
         </w:one>
     '''
     expected = '<one><two><three/><three/></two></one>'
     result = xml_remove_namespaces(xml)
     assert isinstance(result, bytes)
     result = remove_whitespace(result.decode('utf-8'))
     self.assertEqual(result, expected)
Esempio n. 4
0
 def test_remove_namespaces(self):
     xml = b'''<?xml version="1.0"?>
         <w:one xmlns:w="foo">
             <w:two>
                 <w:three/>
                 <w:three/>
             </w:two>
         </w:one>
     '''
     expected = '<one><two><three/><three/></two></one>'
     result = xml_remove_namespaces(xml)
     assert isinstance(result, bytes)
     result = remove_whitespace(result.decode('utf-8'))
     self.assertEqual(result, expected)
Esempio n. 5
0
 def test_remove_namespaces_junk_xml_causes_malformed_exception(self):
     self.assertRaises(MalformedDocxException,
                       lambda: xml_remove_namespaces('foo'))
Esempio n. 6
0
 def test_remove_namespaces_junk_xml_causes_malformed_exception(self):
     self.assertRaises(
         MalformedDocxException,
         lambda: xml_remove_namespaces('foo')
     )