예제 #1
0
 def read(self):
     domDocument = xml.dom.minidom.parse(self.__fd)
     self.__tskversion = self.__parseTskVersionNumber(domDocument)
     tasks = self.__parseTaskNodes(domDocument.documentElement.childNodes)
     tasksAndAllChildren = tasks[:]
     for task in tasks:
         tasksAndAllChildren.extend(task.children(recursive=True))
     tasksById = dict([(task.id(), task) for task in tasksAndAllChildren])
     if self.__tskversion <= 13:
         categories = self.__parseCategoryNodesFromTaskNodes(domDocument, 
                                                             tasksById)
     else:
         categories = self.__parseCategoryNodes( \
             domDocument.documentElement.childNodes, tasksById)
     return tasks, categories
 def assertAttributeWrittenAndRead(self, task, attribute):
     taskWrittenAndRead = self.getTaskWrittenAndRead(task.id())
     self.assertEqual(getattr(task, attribute)(), 
                      getattr(taskWrittenAndRead, attribute)())
 def assertPropertyWrittenAndRead(self, task, property):
     taskWrittenAndRead = self.getTaskWrittenAndRead(task.id())
     self.assertEqual(getattr(task, property), 
                      getattr(taskWrittenAndRead, property))
 def getTaskWrittenAndRead(self, id):
     return [task for task in self.tasksWrittenAndRead if task.id() == id][0]