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)
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)
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)
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)