💚 update unit tests

This commit is contained in:
chfw 2020-10-07 22:19:58 +01:00
parent fb82cf285f
commit ca67cc9609
4 changed files with 14 additions and 18 deletions

View File

@ -30,8 +30,7 @@ from odf.table import Table, TableRow, TableCell
from odf.teletype import extractText
from odf.namespaces import OFFICENS
from odf.opendocument import load
from pyexcel_io.plugin_api import ISheet
from pyexcel_io.plugin_api import IReader, NamedContent
from pyexcel_io.plugin_api import ISheet, IReader, NamedContent
class ODSSheet(ISheet):

View File

@ -12,8 +12,7 @@ from odf.text import P
from odf.table import Table, TableRow, TableCell
from odf.namespaces import OFFICENS
from odf.opendocument import OpenDocumentSpreadsheet
from pyexcel_io.plugin_api import ISheetWriter
from pyexcel_io.plugin_api import IWriter
from pyexcel_io.plugin_api import IWriter, ISheetWriter
class ODSSheetWriter(ISheetWriter):

View File

@ -3,13 +3,14 @@ import os
from base import ODSCellTypes
from pyexcel_ods.odsr import ODSBook
from pyexcel_ods.odsw import ODSWriter
from pyexcel_io.reader import Reader
class TestODSReader(ODSCellTypes):
def setUp(self):
r = ODSBook(
os.path.join("tests", "fixtures", "ods_formats.ods"), "ods"
)
r = Reader("ods")
r.reader_class = ODSBook
r.open(os.path.join("tests", "fixtures", "ods_formats.ods"))
self.data = r.read_all()
for key in self.data.keys():
self.data[key] = list(self.data[key])
@ -18,16 +19,17 @@ class TestODSReader(ODSCellTypes):
class TestODSWriter(ODSCellTypes):
def setUp(self):
r = ODSBook(
os.path.join("tests", "fixtures", "ods_formats.ods"), "ods"
)
r = Reader("ods")
r.reader_class = ODSBook
r.open(os.path.join("tests", "fixtures", "ods_formats.ods"))
r.close()
self.data1 = r.read_all()
self.testfile = "odswriter.ods"
w = ODSWriter(self.testfile, "ods")
w.write(self.data1)
w.close()
r2 = ODSBook(self.testfile, "ods")
self.data = r2.read_all()
r.open(self.testfile)
self.data = r.read_all()
for key in self.data.keys():
self.data[key] = list(self.data[key])

View File

@ -1,7 +1,7 @@
import os
from base import PyexcelWriterBase, PyexcelHatWriterBase
from pyexcel_ods.odsr import ODSBook as Reader
from pyexcel_io import get_data
from pyexcel_ods.odsw import ODSWriter as Writer
@ -16,12 +16,8 @@ class TestNativeODSWriter:
writer = Writer(self.testfile, "ods")
writer.write(self.content)
writer.close()
reader = Reader(self.testfile, "ods")
content = reader.read_all()
for key in content.keys():
content[key] = list(content[key])
content = get_data(self.testfile, library="pyexcel-ods")
assert content == self.content
reader.close()
def tearDown(self):
if os.path.exists(self.testfile):