Skip to content

Commit 0fdb32e

Browse files
committed
🔬 more unit tests and update change log
1 parent 77451f4 commit 0fdb32e

File tree

5 files changed

+36
-11
lines changed

5 files changed

+36
-11
lines changed

changelog.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: pyexcel-ods3
22
organisation: pyexcel
33
releases:
4+
- changes:
5+
- action: added
6+
details:
7+
- '`#28`: support datetime'
8+
date: 1.2.2022
9+
version: 0.6.1
410
- changes:
511
- action: added
612
details:

pyexcel_ods3/odsr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
ods reader
66
7-
:copyright: (c) 2015-2020 by Onni Software Ltd. & its contributors
7+
:copyright: (c) 2015-2022 by Onni Software Ltd. & its contributors
88
:license: New BSD License
99
"""
1010
from io import BytesIO

pyexcel_ods3/odsw.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
ods writer using ezodf
66
7-
:copyright: (c) 2015-2020 by Onni Software Ltd. & its contributors
7+
:copyright: (c) 2015-2022 by Onni Software Ltd. & its contributors
88
:license: New BSD License
99
"""
1010
import types
@@ -44,13 +44,15 @@ def write_row(self, array):
4444
seconds = cell.seconds % 60
4545
cell = "PT%02dH%02dM%02dS" % (hours, minutes, seconds)
4646
value_type = "time"
47-
if value_type == 'datetime':
48-
cell = "%04d-%02d-%02dT%02d:%02d:%02d" % (cell.year,
49-
cell.month,
50-
cell.day,
51-
cell.hour,
52-
cell.minute,
53-
cell.second)
47+
if value_type == "datetime":
48+
cell = "%04d-%02d-%02dT%02d:%02d:%02d" % (
49+
cell.year,
50+
cell.month,
51+
cell.day,
52+
cell.hour,
53+
cell.minute,
54+
cell.second,
55+
)
5456
value_type = "date"
5557
elif value_type == "float":
5658
if cell > MAX_INTEGER:

tests/test_bug_fixes.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/python
2-
# -*- encoding: utf-8 -*-
31
import os
42

53
import psutil

tests/test_writer.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
from pyexcel_ods3 import get_data
55
from pyexcel_ods3.odsw import ODSWriter as Writer
66

7+
from nose.tools import eq_
8+
79

810
class TestNativeODSWriter:
911
def test_write_book(self):
@@ -45,3 +47,20 @@ def setUp(self):
4547
def tearDown(self):
4648
if os.path.exists(self.testfile):
4749
os.unlink(self.testfile)
50+
51+
52+
def test_pr_28():
53+
from datetime import datetime
54+
55+
test_file = "pr28.ods"
56+
test = {"shee1": [[datetime(2022, 1, 30, 15, 45, 45)]]}
57+
writer = Writer(test_file, "ods")
58+
writer.write(test)
59+
writer.close()
60+
61+
content = get_data(test_file)
62+
for key in content.keys():
63+
content[key] = list(content[key])
64+
eq_(content, {"shee1": [[datetime(2022, 1, 30, 15, 45, 45)]]})
65+
66+
os.unlink(test_file)

0 commit comments

Comments
 (0)