Exemple #1
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 = remove_namespaces(xml)
     assert isinstance(result, bytes)
     result = remove_whitespace(result.decode('utf-8'))
     self.assertEqual(result, expected)
Exemple #2
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 = remove_namespaces(xml)
     assert isinstance(result, bytes)
     result = remove_whitespace(result.decode("utf-8"))
     self.assertEqual(result, expected)
Exemple #3
0
 def test_remove_namespaces_junk_xml_causes_malformed_exception(self):
     self.assertRaises(MalformedDocxException,
                       lambda: remove_namespaces('foo'))
Exemple #4
0
 def test_remove_namespaces_junk_xml_causes_malformed_exception(self):
     self.assertRaises(MalformedDocxException, lambda: remove_namespaces("foo"))