Commit 8f109731 authored by Hugo H. Maia Vieira's avatar Hugo H. Maia Vieira

Refactoring

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@41104 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a61fd142
......@@ -83,10 +83,10 @@ class OOGranulate(object):
def getImageItemList(self):
"""Return a list of tuples with the id and title of image files"""
xml_images = self._getElementsByTagName(self.document.parsed_content,
'draw:image')
xml_image_list = self._getElementsByTagName(self.document.parsed_content,
'draw:image')
image_list = []
for image in xml_images:
for image in xml_image_list:
title = self._getImageTitle(image)
id = image.values()[0].split('/')[-1]
image_list.append((id, title))
......
......@@ -39,27 +39,27 @@ class TestOOGranulate(cloudoooTestCase):
def testGetElementsByTagName(self):
"""Test if _getElementsByTagName() returns right elements list"""
elements = self.oogranulate._getElementsByTagName(
element_list = self.oogranulate._getElementsByTagName(
self.oogranulate.document.parsed_content,
'draw:image')
self.assertEquals(len(elements), 5)
for element in elements:
self.assertEquals(len(element_list), 5)
for element in element_list:
self.assertTrue(element.tag.endswith('image'))
def testHasAncertor(self):
images = self.oogranulate._getElementsByTagName(
image_list = self.oogranulate._getElementsByTagName(
self.oogranulate.document.parsed_content,
'draw:image')
self.assertFalse(self.oogranulate._hasAncestor(images[0], 'text-box'))
self.assertTrue(self.oogranulate._hasAncestor(images[0], 'frame'))
self.assertTrue(self.oogranulate._hasAncestor(images[2], 'text-box'))
self.assertFalse(self.oogranulate._hasAncestor(image_list[0], 'text-box'))
self.assertTrue(self.oogranulate._hasAncestor(image_list[0], 'frame'))
self.assertTrue(self.oogranulate._hasAncestor(image_list[2], 'text-box'))
def testGetImageTitle(self):
images = self.oogranulate._getElementsByTagName(
image_list = self.oogranulate._getElementsByTagName(
self.oogranulate.document.parsed_content,
'draw:image')
self.assertEquals(self.oogranulate._getImageTitle(images[0]), '')
self.assertEquals(self.oogranulate._getImageTitle(images[2]),
self.assertEquals(self.oogranulate._getImageTitle(image_list[0]), '')
self.assertEquals(self.oogranulate._getImageTitle(image_list[2]),
'Illustration 1: TioLive Logo')
def testgetTableItemList(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment