def testConvertToText(self): rep = TextRepresentation(TestTextRepresentation.pdfFile, TEMPDIRUNITTEST, LOGDIR) rep.convertToText() MyFile.checkFileExists(TestTextRepresentation.tmpPdfFile) rep = TextRepresentation(TestTextRepresentation.textFile, TEMPDIRUNITTEST, LOGDIR) rep.convertToText() MyFile.checkFileExists(TestTextRepresentation.tmpTextFile)
def loadTextFile(self): """Load converted text file. """ if self.tempFilePath is None or not MyFile.checkFileExists(self.tempFilePath): raise Exception("Temporary text file does not exist!") io = Ioread() self.sentencesList = io.readFileContentList(self.tempFilePath)
def loadTextFile(self): """Load converted text file. """ if self.tempFilePath is None or not MyFile.checkFileExists( self.tempFilePath): raise Exception("Temporary text file does not exist!") io = Ioread() self.sentencesList = io.readFileContentList(self.tempFilePath)
def testGatherInputData(self): #No data olist task1 = Task( TaskInfo("", TestTask.workingDirectory, TestTask.targetFolderErr1)) with self.assertRaises(Exception): task1.gatherInputData() #No map .omap task1 = Task( TaskInfo("", TestTask.workingDirectory, TestTask.targetFolderErr2)) with self.assertRaises(Exception): task1.gatherInputData() task1 = Task( TaskInfo("", TestTask.workingDirectory, TestTask.targetFolder1)) task1.gatherInputData() self.assertTrue(MyFile.checkFileExists(task1.getTaskDirectory())) self.assertTrue(MyFile.checkFileExists(task1.getInputDirectory())) self.assertTrue(MyFile.checkFileExists(task1.getTempDirectory())) self.assertTrue(MyFile.checkFileExists(task1.getOutputDirectory())) dataListPath = "%s%s%s" % (task1.getInputDirectory(), os.sep, 'data.ilist') dataMap1Path = "%s%s%s" % (task1.getInputDirectory(), os.sep, 'audio.imap') dataMap2Path = "%s%s%s" % (task1.getInputDirectory(), os.sep, 'model.imap') self.assertTrue(MyFile.checkFileExists(dataListPath)) self.assertTrue(MyFile.checkFileExists(dataMap1Path)) self.assertTrue(MyFile.checkFileExists(dataMap2Path)) self.assertEqual(15, task1.inputList.getCount()) self.assertEqual(2, len(task1.mapLists)) for dataMap in task1.mapLists: self.assertTrue(dataMap.getCount() in [2, 1]) task1 = Task( TaskInfo("", TestTask.workingDirectory, TestTask.targetFolderErr)) #Two input lists with self.assertRaises(Exception): task1.gatherInputData()
def testGatherInputData(self): #No data olist task1 = Task(TaskInfo("",TestTask.workingDirectory, TestTask.targetFolderErr1)) with self.assertRaises(Exception): task1.gatherInputData() #No map .omap task1 = Task(TaskInfo("",TestTask.workingDirectory, TestTask.targetFolderErr2)) with self.assertRaises(Exception): task1.gatherInputData() task1 = Task(TaskInfo("",TestTask.workingDirectory, TestTask.targetFolder1)) task1.gatherInputData() self.assertTrue(MyFile.checkFileExists(task1.getTaskDirectory())) self.assertTrue(MyFile.checkFileExists(task1.getInputDirectory())) self.assertTrue(MyFile.checkFileExists(task1.getTempDirectory())) self.assertTrue(MyFile.checkFileExists(task1.getOutputDirectory())) dataListPath = "%s%s%s" % (task1.getInputDirectory(),os.sep,'data.ilist') dataMap1Path = "%s%s%s" % (task1.getInputDirectory(),os.sep,'audio.imap') dataMap2Path = "%s%s%s" % (task1.getInputDirectory(),os.sep,'model.imap') self.assertTrue(MyFile.checkFileExists(dataListPath)) self.assertTrue(MyFile.checkFileExists(dataMap1Path)) self.assertTrue(MyFile.checkFileExists(dataMap2Path)) self.assertEquals(15,task1.inputList.getCount()) self.assertEquals(2,len(task1.mapLists)) for dataMap in task1.mapLists: self.assertTrue(dataMap.getCount() in [2,1]) task1 = Task(TaskInfo("",TestTask.workingDirectory, TestTask.targetFolderErr)) #Two input lists with self.assertRaises(Exception): task1.gatherInputData()