def test_image_id_for_pict(self): tree = self.get_xml() # Get all the pict tags pict_tags = tree.xpath('.//w:pict', namespaces=tree.nsmap) self.assertEqual(len(pict_tags), 1) # Get the image id for the pict tag. pict_tag = pict_tags[0] image_id = get_image_id(pict_tag) self.assertEqual(image_id, 'rId0')
def test_get_image_id(self): tree = self.get_xml() els = [] w_namespace = get_namespace(tree, 'w') for el in tree.iter(): if el.tag == '%sdrawing' % w_namespace: els.append(el) if el.tag == '%spict' % w_namespace: els.append(el) image_ids = [] for el in els: image_ids.append(get_image_id(el)) self.assertEqual(image_ids, [ 'rId0', 'rId1', ])
def test_get_image_id(self): tree = self.get_xml() els = [] w_namespace = get_namespace(tree, 'w') for el in tree.iter(): if el.tag == '%sdrawing' % w_namespace: els.append(el) if el.tag == '%spict' % w_namespace: els.append(el) image_ids = [] for el in els: image_ids.append(get_image_id(el)) self.assertEqual( image_ids, [ 'rId0', 'rId1', ] )