-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
64 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,34 @@ | ||
import os | ||
from pyexcel_io import CSVZipBook, CSVZipWriter | ||
from nose.tools import raises | ||
import zipfile | ||
|
||
class TestCVSZReading: | ||
class TestCSVZ: | ||
def setUp(self): | ||
self.file = "csvz.csvz" | ||
|
||
def test_writing(self): | ||
data = [[1,2,3]] | ||
file_name = 'pyexcel_sheet1.csv' | ||
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'] | ||
assert zip.namelist() == [file_name] | ||
content = zip.read(file_name) | ||
assert content.replace('\r','').strip('\n') == "1,2,3" | ||
|
||
def test_reading(self): | ||
data = [[1,2,3]] | ||
zipbook = CSVZipWriter(self.file) | ||
sheet = zipbook.create_sheet(None) | ||
sheet.write_array(data) | ||
sheet.close() | ||
zipbook.close() | ||
zipreader = CSVZipBook(self.file) | ||
data = zipreader.sheets() | ||
assert data['pyexcel_sheet1'] == [['1','2','3']] | ||
|
||
def tearDown(self): | ||
os.unlink(self.file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters