예제 #1
0
	def testGetParametersDict(self):
		task1 = Task(TaskInfo("",TestTask.workingDirectory,
			                     TestTask.targetFolder1))

		paramDict = task1.getTaskInfo().getParametersDict()

		self.assertEquals(0, len(paramDict))
예제 #2
0
    def testGetParametersDict(self):
        task1 = Task(
            TaskInfo("", TestTask.workingDirectory, TestTask.targetFolder1))

        paramDict = task1.getTaskInfo().getParametersDict()

        self.assertEqual(0, len(paramDict))
예제 #3
0
	def testExecute(self):
		task1 = Task(TaskInfo("",TestTask.workingDirectory,
			                     TestTask.targetFolder1))

		task1.validateParameters = lambda : Task.validateParameters(task1,[])

		task1.execute()
예제 #4
0
    def testSetResults(self):
        task1 = Task(
            TaskInfo("", TestTask.workingDirectory, TestTask.targetFolder1))

        task1.setResult("error", "message")
        self.assertEqual("error", task1.resultErrorFlag)
        self.assertEqual("message", task1.resultMessage)
예제 #5
0
	def testSetResults(self):
		task1 = Task(TaskInfo("",TestTask.workingDirectory,
			                     TestTask.targetFolder1))
		

		task1.setResult("error", "message")
		self.assertEqual("error", task1.resultErrorFlag)
		self.assertEqual("message", task1.resultMessage)
예제 #6
0
    def __init__(self, taskInfo):
        """Default constructor.
        """
        Task.__init__(self, taskInfo)

        self.count = 0
        self.debug = False
        self.textFiltering = False
        self.removePunctuation = False
        self.verbalizePunctuation = False
        self.lmModeling = False
예제 #7
0
    def __init__(self, taskInfo):
        """Default constructor.
        """
        Task.__init__(self, taskInfo)

        self.count = 0
        self.debug = False
        self.textFiltering = False
        self.removePunctuation = False
        self.verbalizePunctuation = False
        self.lmModeling = False
예제 #8
0
	def testValidateParameters(self):
		task1 = Task(TaskInfo("",TestTask.workingDirectory,
			                     TestTask.targetFolder1))

		with self.assertRaises(Exception):
			task1.validateParameters(["param1"])

		Task.COMMON_PARAMETERS = ["param1"]

		with self.assertRaises(Exception):
			task1.validateParameters([])

		Task.COMMON_PARAMETERS = []
예제 #9
0
    def validateParameters(self):
        """Check that language and batch file
           parameters are specified.
        """

        self._log(logging.INFO, "Validate parameters")

        return Task.validateParameters(self, ImportDocumentTask.PARAMETERS)
예제 #10
0
    def validateParameters(self):
        """Check that language and batch file
           parameters are specified.
        """

        self._log(logging.INFO, "Validate parameters")

        return Task.validateParameters(self,
                    ImportDocumentTask.PARAMETERS)
예제 #11
0
    def testExecute(self):
        task1 = Task(
            TaskInfo("", TestTask.workingDirectory, TestTask.targetFolder1))

        task1.validateParameters = lambda: Task.validateParameters(task1, [])

        task1.execute()
예제 #12
0
	def testBuildParametersDict(self):
		task1 = Task(TaskInfo("param1=v1;param2=v2",
			                   TestTask.workingDirectory,
			                   TestTask.targetFolder1))

		task1._buildParametersDictionary()

		task1 = Task(TaskInfo("param1=;param2=v2",
			                   TestTask.workingDirectory,
			                   TestTask.targetFolder1))

		with self.assertRaises(Exception):
			task1._buildParametersDictionary()

		task1 = Task(TaskInfo("=v1;param2=v2",
			                   TestTask.workingDirectory,
			                   TestTask.targetFolder1))

		with self.assertRaises(Exception):
			task1._buildParametersDictionary()
예제 #13
0
    def testValidateParameters(self):
        task1 = Task(
            TaskInfo("", TestTask.workingDirectory, TestTask.targetFolder1))

        with self.assertRaises(Exception):
            task1.validateParameters(["param1"])

        Task.COMMON_PARAMETERS = ["param1"]

        with self.assertRaises(Exception):
            task1.validateParameters([])

        Task.COMMON_PARAMETERS = []
예제 #14
0
    def testBuildTaskPath(self):
        task1 = Task(
            TaskInfo("", TestTask.workingDirectory, TestTask.targetFolder1))

        with self.assertRaises(Exception):
            task1._buildTaskPath("path")
예제 #15
0
    def testBuildTask(self):
        task1 = Task(
            TaskInfo("", TestTask.workingDirectory, TestTask.targetFolder1))

        self.assertTrue(task1.taskUniqueId > 0)
예제 #16
0
    def testBuildParametersDict(self):
        task1 = Task(
            TaskInfo("param1=v1;param2=v2", TestTask.workingDirectory,
                     TestTask.targetFolder1))

        task1._buildParametersDictionary()

        task1 = Task(
            TaskInfo("param1=;param2=v2", TestTask.workingDirectory,
                     TestTask.targetFolder1))

        with self.assertRaises(Exception):
            task1._buildParametersDictionary()

        task1 = Task(
            TaskInfo("=v1;param2=v2", TestTask.workingDirectory,
                     TestTask.targetFolder1))

        with self.assertRaises(Exception):
            task1._buildParametersDictionary()
예제 #17
0
    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()
예제 #18
0
	def testBuildTaskPath(self):
		task1 = Task(TaskInfo("",TestTask.workingDirectory,
			                     TestTask.targetFolder1))
		
		with self.assertRaises(Exception):
			task1._buildTaskPath("path")
예제 #19
0
	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()