def testExecute(self):
        self.run()

        # Checks the expected result
        strObtainedOutput = self.readAndParseFile(self.m_edObtainedOutputDataFile)
        from XSDataMOSFLMv10 import XSDataMOSFLMOutputGeneratePrediction
        xsDataMOSFLMOutputGeneratePrediction = XSDataMOSFLMOutputGeneratePrediction.parseString(strObtainedOutput)
        strImagePath = xsDataMOSFLMOutputGeneratePrediction.getPredictionImage().getPath().getValue()
        bImageExists = os.path.exists(strImagePath)
        EDAssert.strAlmostEqual(True, bImageExists, "(Test if the image with prediction exists)")
Example #2
0
    def testExecute(self):
        self.run()

        # Checks the expected result
        strObtainedOutput = self.readAndParseFile(
            self.m_edObtainedOutputDataFile)
        from XSDataMOSFLMv10 import XSDataMOSFLMOutputGeneratePrediction
        xsDataMOSFLMOutputGeneratePrediction = XSDataMOSFLMOutputGeneratePrediction.parseString(
            strObtainedOutput)
        strImagePath = xsDataMOSFLMOutputGeneratePrediction.getPredictionImage(
        ).getPath().getValue()
        bImageExists = os.path.exists(strImagePath)
        EDAssert.strAlmostEqual(True, bImageExists,
                                "(Test if the image with prediction exists)")
    def testCreateDataMOSFLMOutputGeneratePrediction(self):
        """
        """
        pluginGeneratePrediction = self.createPlugin()
        pluginGeneratePrediction.setScriptExecutable("cat")
        pluginGeneratePrediction.configure()
        pluginGeneratePrediction.setPredictionImageFileName("prediction.jpg")
        stringBaseName = pluginGeneratePrediction.getBaseName()
        stringNewmatFile = os.path.join(
            self.strUnitTestDataHome, "EDPluginMOSFLMv10_autoindexMat_ok.txt")
        pluginGeneratePrediction.setNewmatFileName(stringNewmatFile)
        from XSDataMOSFLMv10 import XSDataMOSFLMInputGeneratePrediction
        xsDataMOSFLMInputGeneratePrediction = XSDataMOSFLMInputGeneratePrediction.parseFile(
            os.path.join(self.strUnitTestDataHome,
                         "XSDataMOSFLMInputGeneratePrediction_reference.xml"))
        pluginGeneratePrediction.setDataInput(
            xsDataMOSFLMInputGeneratePrediction)
        xsDataMOSFLMOutputGeneratePrediction = pluginGeneratePrediction.createDataMOSFLMOutputGeneratePrediction(
        )
        stringImagePath = xsDataMOSFLMOutputGeneratePrediction.getPredictionImage(
        ).getPath().getValue()
        stringReferenceXML = self.readAndParseFile(
            self.strReferenceDataOutputFile)
        from XSDataMOSFLMv10 import XSDataMOSFLMOutputGeneratePrediction
        xsDataMOSFLMOutputGeneratePredictionReference = XSDataMOSFLMOutputGeneratePrediction.parseString(
            stringReferenceXML)
        xsDataImage = xsDataMOSFLMOutputGeneratePredictionReference.getPredictionImage(
        )
        xsDataImage.setPath(XSDataString(stringImagePath))
        xsDataMOSFLMOutputGeneratePredictionReference.setPredictionImage(
            xsDataImage)
        # Replace path to log file since it cannot be determined by the unit test
        xsDataMOSFLMOutputGeneratePrediction.setPathToLogFile(
            XSDataFile(XSDataString("MOSFLMGeneratePredictionv10.log")))
        EDAssert.equal(xsDataMOSFLMOutputGeneratePredictionReference.marshal(),
                       xsDataMOSFLMOutputGeneratePrediction.marshal())

        self.cleanUp(pluginGeneratePrediction)
    def testCreateDataMOSFLMOutputGeneratePrediction(self):
        """
        """
        pluginGeneratePrediction = self.createPlugin()
        pluginGeneratePrediction.setScriptExecutable("cat")
        pluginGeneratePrediction.configure()
        pluginGeneratePrediction.setPredictionImageFileName("prediction.jpg")
        stringBaseName = pluginGeneratePrediction.getBaseName()
        stringNewmatFile = os.path.join(self.strUnitTestDataHome, "EDPluginMOSFLMv10_autoindexMat_ok.txt")
        pluginGeneratePrediction.setNewmatFileName(stringNewmatFile)
        from XSDataMOSFLMv10 import XSDataMOSFLMInputGeneratePrediction

        xsDataMOSFLMInputGeneratePrediction = XSDataMOSFLMInputGeneratePrediction.parseFile(
            os.path.join(self.strUnitTestDataHome, "XSDataMOSFLMInputGeneratePrediction_reference.xml")
        )
        pluginGeneratePrediction.setDataInput(xsDataMOSFLMInputGeneratePrediction)
        xsDataMOSFLMOutputGeneratePrediction = pluginGeneratePrediction.createDataMOSFLMOutputGeneratePrediction()
        stringImagePath = xsDataMOSFLMOutputGeneratePrediction.getPredictionImage().getPath().getValue()
        stringReferenceXML = self.readAndParseFile(self.strReferenceDataOutputFile)
        from XSDataMOSFLMv10 import XSDataMOSFLMOutputGeneratePrediction

        xsDataMOSFLMOutputGeneratePredictionReference = XSDataMOSFLMOutputGeneratePrediction.parseString(
            stringReferenceXML
        )
        xsDataImage = xsDataMOSFLMOutputGeneratePredictionReference.getPredictionImage()
        xsDataImage.setPath(XSDataString(stringImagePath))
        xsDataMOSFLMOutputGeneratePredictionReference.setPredictionImage(xsDataImage)
        # Replace path to log file since it cannot be determined by the unit test
        xsDataMOSFLMOutputGeneratePrediction.setPathToLogFile(
            XSDataFile(XSDataString("MOSFLMGeneratePredictionv10.log"))
        )
        EDAssert.equal(
            xsDataMOSFLMOutputGeneratePredictionReference.marshal(), xsDataMOSFLMOutputGeneratePrediction.marshal()
        )

        self.cleanUp(pluginGeneratePrediction)