💚 unit test timedelta

This commit is contained in:
chfw 2021-10-02 15:01:53 +01:00
parent e309f9e45a
commit 4b774fc1ae
2 changed files with 12 additions and 3 deletions

View File

@ -152,9 +152,7 @@ class XLSReader(IReader):
def read_sheet(self, index):
native_sheet = self.content_array[index]
sheet = XLSheet(
native_sheet,
date_mode=self.xls_book.datemode,
**self._keywords
native_sheet, date_mode=self.xls_book.datemode, **self._keywords
)
return sheet

View File

@ -37,6 +37,15 @@ class TestDateFormat:
datetime.date(2014, 12, 25),
datetime.time(11, 11, 11),
datetime.datetime(2014, 12, 25, 11, 11, 11),
datetime.timedelta(
days=50,
seconds=27,
microseconds=10,
milliseconds=29000,
minutes=5,
hours=8,
weeks=2,
),
]
]
pe.save_as(dest_file_name=excel_filename, array=data)
@ -47,6 +56,8 @@ class TestDateFormat:
assert r[0, 1].strftime("%H:%M:%S") == "11:11:11"
assert isinstance(r[0, 2], datetime.date) is True
assert r[0, 2].strftime("%d/%m/%y %H:%M:%S") == "25/12/14 11:11:11"
assert isinstance(r[0, 2], datetime.timedelta)
assert r[0, 1].strftime("%H:%M:%S") == "3:30:20"
os.unlink(excel_filename)