💚 fix styling problem

This commit is contained in:
chfw 2019-07-14 08:21:12 +01:00
parent 84ec6199fb
commit 3b6a380b70
2 changed files with 8 additions and 3 deletions

View File

@ -233,9 +233,13 @@ def _convert_content_to_stream(file_content, file_type):
stream = manager.get_io(file_type)
if not PY2:
target_content_type = manager.get_io_type(file_type)
if target_content_type == 'bytes' and not isinstance(file_content, bytes):
needs_encode = (target_content_type == 'bytes' and
not isinstance(file_content, bytes))
needs_decode = (target_content_type == 'string' and
isinstance(file_content, bytes))
if needs_encode:
file_content = file_content.encode('utf-8')
elif target_content_type == 'string' and isinstance(file_content, bytes):
elif needs_decode:
file_content = file_content.decode('utf-8')
stream.write(file_content)
stream.seek(0)

View File

@ -1,5 +1,6 @@
from nose.tools import raises
from pyexcel_io.book import RWInterface, BookReader, BookWriter, _convert_content_to_stream
from pyexcel_io.book import RWInterface, BookReader, BookWriter
from pyexcel_io.book import _convert_content_to_stream
from pyexcel_io._compact import PY2, StringIO, BytesIO
from nose import SkipTest