Exemple #1
0
    def testWriteEmptyFile(self):
        _, filename = tempfile.mkstemp('.xls')
        writer = Writer(filename)
        writer.saveFile()

        reader = Reader(filename)
        rows = reader.openFile()
        assert len(rows) == 0

        os.remove(filename)
Exemple #2
0
    def testWriteEmptyFile(self):
        _, filename = tempfile.mkstemp('.xls')
        writer = Writer(filename)
        writer.saveFile()

        reader = Reader(filename)
        rows = reader.openFile()
        assert len(rows) == 0

        os.remove(filename)
Exemple #3
0
    def testWriteNullCell(self):
        _, filename = tempfile.mkstemp('.xls')
        writer = Writer(filename)
        row0 = ['ID', 'NUMBER']
        row1 = ['0', None]
        writer.writeAttributeRow(0, row0)
        writer.writeAttributeRow(1, row1)
        writer.saveFile()

        reader = Reader(filename)
        rows = reader.openFile()
        assert rows[1][1] == 'NULL'

        os.remove(filename)
Exemple #4
0
    def testQByteArrayCell(self):
        _, filename = tempfile.mkstemp('.xls')
        writer = Writer(filename)
        row0 = ['ID', 'NUMBER']
        row1 = [QByteArray('0'), QByteArray('42')]
        writer.writeAttributeRow(0, row0)
        writer.writeAttributeRow(1, row1)
        writer.saveFile()

        reader = Reader(filename)
        rows = reader.openFile()
        assert rows[1][0] == 0
        assert rows[1][1] == 42

        os.remove(filename)
Exemple #5
0
    def testWriteCorrectFile(self):
        _, filename = tempfile.mkstemp('.xls')
        writer = Writer(filename)
        row0 = ['ID', 'NUMBER']
        row1 = ['0', '42']
        writer.writeAttributeRow(0, row0)
        writer.writeAttributeRow(1, row1)
        writer.saveFile()

        reader = Reader(filename)
        rows = reader.openFile()
        assert len(rows) == 2
        assert rows[0] == row0
        assert rows[1][0] == 0
        assert rows[1][1] == 42

        os.remove(filename)
Exemple #6
0
    def testWriteNullCell(self):
        _, filename = tempfile.mkstemp('.xls')
        writer = Writer(filename)
        row0 = ['ID', 'NUMBER']
        row1 = ['0', None]
        writer.writeAttributeRow(0, row0)
        writer.writeAttributeRow(1, row1)
        writer.saveFile()

        reader = Reader(filename)
        rows = reader.openFile()
        assert rows[1][1] == 'NULL'

        os.remove(filename)
Exemple #7
0
    def testQByteArrayCell(self):
        _, filename = tempfile.mkstemp('.xls')
        writer = Writer(filename)
        row0 = ['ID', 'NUMBER']
        row1 = [QByteArray('0'), QByteArray('42')]
        writer.writeAttributeRow(0, row0)
        writer.writeAttributeRow(1, row1)
        writer.saveFile()

        reader = Reader(filename)
        rows = reader.openFile()
        assert rows[1][0] == 0
        assert rows[1][1] == 42

        os.remove(filename)
Exemple #8
0
    def testWriteCorrectFile(self):
        _, filename = tempfile.mkstemp('.xls')
        writer = Writer(filename)
        row0 = ['ID', 'NUMBER']
        row1 = ['0', '42']
        writer.writeAttributeRow(0, row0)
        writer.writeAttributeRow(1, row1)
        writer.saveFile()

        reader = Reader(filename)
        rows = reader.openFile()
        assert len(rows) == 2
        assert rows[0] == row0
        assert rows[1][0] == 0
        assert rows[1][1] == 42

        os.remove(filename)