Skip to content

Commit

Permalink
test csvzipwriter
Browse files Browse the repository at this point in the history
  • Loading branch information
chfw committed May 14, 2015
1 parent 620710a commit 4f5503e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
10 changes: 0 additions & 10 deletions pyexcel_io/_compact.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from StringIO import StringIO
from StringIO import StringIO as BytesIO
text_type = unicode
exec('def reraise(tp, value, tb=None):\n raise tp, value, tb')
class Iterator(object):
def next(self):
return type(self).__next__(self)
Expand All @@ -32,20 +31,11 @@ def isstream(instance):
else:
from io import StringIO, BytesIO
text_type = str
def reraise(tp, value, tb=None):
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
raise value
Iterator = object
def isstream(instance):
return isinstance(instance, StringIO) or isinstance(instance, BytesIO)


def is_array_type(an_array, atype):
tmp = [i for i in an_array if not isinstance(i, atype)]
return len(tmp) == 0


def is_string(atype):
"""find out if a type is str or not"""
if atype == str:
Expand Down
18 changes: 18 additions & 0 deletions tests/test_csvz_book.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os
from pyexcel_io import CSVZipBook, CSVZipWriter
from nose.tools import raises
import zipfile

class TestCVSZReading:
def setUp(self):
self.file = "csvz.csvz"

def test_writing(self):
data = [[1,2,3]]
zipbook = CSVZipWriter(self.file)
sheet = zipbook.create_sheet(None)
sheet.write_array(data)
sheet.close()
zipbook.close()
zip = zipfile.ZipFile(self.file, 'r')
assert zip.namelist() == ['pyexcel_sheet.csv']

0 comments on commit 4f5503e

Please sign in to comment.