Skip to content

Commit

Permalink
💚 unit test timedelta
Browse files Browse the repository at this point in the history
  • Loading branch information
chfw committed Oct 2, 2021
1 parent e309f9e commit 4b774fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 1 addition & 3 deletions pyexcel_xls/xlsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ def __init__(self, file_type, **keywords):
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

Expand Down
11 changes: 11 additions & 0 deletions tests/test_formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ def test_writing_date_format(self):
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)
Expand All @@ -47,6 +56,8 @@ def test_writing_date_format(self):
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)


Expand Down

0 comments on commit 4b774fc

Please sign in to comment.