Skip to content

Commit

Permalink
💚 fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chfw committed Aug 27, 2017
1 parent bb8b97f commit 32c7728
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 33 deletions.
14 changes: 1 addition & 13 deletions pyexcel_ods/odsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
# limitations under the License.

# Thanks to grt for the fixes
from io import UnsupportedOperation

from odf.teletype import extractText
from odf.table import TableRow, TableCell, Table
from odf.text import P
Expand All @@ -32,7 +30,7 @@

from pyexcel_io.book import BookReader
from pyexcel_io.sheet import SheetReader
from pyexcel_io._compact import OrderedDict, BytesIO
from pyexcel_io._compact import OrderedDict
import pyexcel_io.service as service


Expand Down Expand Up @@ -104,16 +102,6 @@ def open(self, file_name, **keywords):

def open_stream(self, file_stream, **keywords):
"""open ods file stream"""
if not hasattr(file_stream, 'seek'):
# python 2
# Hei zipfile in odfpy would do a seek
# but stream from urlib cannot do seek
file_stream = BytesIO(file_stream.read())
try:
file_stream.seek(0)
except UnsupportedOperation:
# python 3
file_stream = BytesIO(file_stream.read())
BookReader.open_stream(self, file_stream, **keywords)
self._load_from_memory()

Expand Down
2 changes: 1 addition & 1 deletion pyexcel_ods/odsw.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from pyexcel_io.book import BookWriter
from pyexcel_io.sheet import SheetWriter

import pyexcel_ods.converter as converter
import pyexcel_io.service as converter

PY2 = sys.version_info[0] == 2

Expand Down
19 changes: 0 additions & 19 deletions tests/test_bug_fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,6 @@ def test_bug_fix_for_issue_2():
assert new_data["Sheet 2"] == [[u'row 1', u'H\xe9ll\xf4!', u'Hol\xc1!']]


def test_date_util_parse():
from pyexcel_ods.converter import date_value
value = "2015-08-17T19:20:00"
d = date_value(value)
assert d.strftime("%Y-%m-%dT%H:%M:%S") == "2015-08-17T19:20:00"
value = "2015-08-17"
d = date_value(value)
assert d.strftime("%Y-%m-%d") == "2015-08-17"
value = "2015-08-17T19:20:59.999999"
d = date_value(value)
assert d.strftime("%Y-%m-%dT%H:%M:%S") == "2015-08-17T19:20:59"
value = "2015-08-17T19:20:59.99999"
d = date_value(value)
assert d.strftime("%Y-%m-%dT%H:%M:%S") == "2015-08-17T19:20:59"
value = "2015-08-17T19:20:59.999999999999999"
d = date_value(value)
assert d.strftime("%Y-%m-%dT%H:%M:%S") == "2015-08-17T19:20:59"


@raises(Exception)
def test_invalid_date():
from pyexcel_ods.ods import date_value
Expand Down

0 comments on commit 32c7728

Please sign in to comment.