Exemplo n.º 1
0
    def test_colorImageXml(self):
        """
        Test the XML representation of a color image to match the reference.
        """
        sourcePath = 'files/sunflower' + self.ext
        expectedPath = 'files/sunflower.xml'

        message = Message(filePath=sourcePath, messageType='ColorImage')

        with open(self.targetTextFilePath, 'w') as xmlFile:
            xmlString = message.getXmlString()
            xmlFile.write(xmlString)

        actualTextFile, expectedTextFile = loadTwoTextFiles(self.targetTextFilePath, expectedPath)

        self.assertEqual(actualTextFile, expectedTextFile)
Exemplo n.º 2
0
    def test_longTextXml(self):
        """
        Test the XML representation of a long text file to match the reference.
        """
        sourcePath = 'files/full.txt'
        expectedPath = 'files/full.xml'

        message = Message(filePath=sourcePath, messageType='Text')

        with open(self.targetTextFilePath, 'w') as xmlFile:
            xmlString = message.getXmlString()
            xmlFile.write(xmlString)

        actualTextFile, expectedTextFile = loadTwoTextFiles(self.targetTextFilePath, expectedPath)

        self.assertEqual(actualTextFile, expectedTextFile)
Exemplo n.º 3
0
    def test_colorImageXml(self):
        """
        Test the XML representation of a color image to match the reference.
        """
        sourcePath = 'files/sunflower' + self.ext
        expectedPath = 'files/sunflower.xml'

        message = Message(filePath=sourcePath, messageType='ColorImage')

        with open(self.targetTextFilePath, 'w') as xmlFile:
            xmlString = message.getXmlString()
            xmlFile.write(xmlString)

        actualTextFile, expectedTextFile = loadTwoTextFiles(
            self.targetTextFilePath, expectedPath)

        self.assertEqual(actualTextFile, expectedTextFile)
Exemplo n.º 4
0
    def test_longTextXml(self):
        """
        Test the XML representation of a long text file to match the reference.
        """
        sourcePath = 'files/full.txt'
        expectedPath = 'files/full.xml'

        message = Message(filePath=sourcePath, messageType='Text')

        with open(self.targetTextFilePath, 'w') as xmlFile:
            xmlString = message.getXmlString()
            xmlFile.write(xmlString)

        actualTextFile, expectedTextFile = loadTwoTextFiles(
            self.targetTextFilePath, expectedPath)

        self.assertEqual(actualTextFile, expectedTextFile)