Skip to content

Commit fa1cfd7

Browse files
committed
code change needed to adapt to the new pyexcel v0.2.2
1 parent 04ee10a commit fa1cfd7

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

pyexcel_webio/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,7 @@ def make_response(pyexcel_instance, file_type,
242242
:param status: unless a different status is to be returned.
243243
:returns: http response
244244
"""
245-
io = pe.get_io(file_type)
246-
pyexcel_instance.save_to_memory(file_type, io, **keywords)
245+
io = pyexcel_instance.save_to_memory(file_type, None, **keywords)
247246
return _make_response(io, file_type, status, file_name)
248247

249248

test.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nosetests --with-cov --cov pyexcel_webio --cov tests --with-doctest --doctest-extension=.rst
1+
nosetests --with-coverage --cover-package pyexcel_webio --cover-package tests --with-doctest --doctest-extension=.rst

test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
pip freeze
2-
nosetests --rednose --with-cov --cov pyexcel_webio --cov tests --with-doctest --doctest-extension=.rst
2+
nosetests --with-coverage --cover-package pyexcel_webio --cover-package tests --with-doctest --doctest-extension=.rst

tests/test_webio.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import os
2+
import sys
3+
from unittest import TestCase
24
import pyexcel as pe
3-
from pyexcel.ext import webio
4-
from pyexcel.ext import xls
5+
import pyexcel_webio as webio
56
from db import Session, Base, Signature, Signature2, engine
6-
import sys
77
if sys.version_info[0] == 2 and sys.version_info[1] < 7:
88
from ordereddict import OrderedDict
99
else:
@@ -166,28 +166,28 @@ def test_wrong_file_tuple_returned(self):
166166
myinput.get_sheet(field_name=('xls', None))
167167

168168

169-
class TestExcelInputOnBook:
169+
class TestExcelInputOnBook(TestCase):
170170
def setUp(self):
171171
self.data = [['X', 'Y', 'Z'], [1, 2, 3], [4, 5, 6]]
172172
self.data1 = [['A', 'B', 'C'], [1, 2, 3], [4, 5, 6]]
173173
mydict = OrderedDict()
174-
mydict.update({'sheet1': self.data})
175-
mydict.update({'sheet2': self.data1})
174+
mydict.update({'signature': self.data})
175+
mydict.update({'signature2': self.data1})
176176
book = pe.Book(mydict)
177177
self.testfile = "testfile.xls"
178178
book.save_as(self.testfile)
179179

180180
def test_get_book(self):
181181
myinput = TestInput()
182182
result = myinput.get_book(file_name=self.testfile)
183-
assert result["sheet1"].to_array() == self.data
184-
assert result["sheet2"].to_array() == self.data1
183+
assert result["signature"].to_array() == self.data
184+
assert result["signature2"].to_array() == self.data1
185185

186186
def test_get_book_dict(self):
187187
myinput = TestInput()
188188
result = myinput.get_book_dict(file_name=self.testfile)
189-
assert result["sheet1"] == self.data
190-
assert result["sheet2"] == self.data1
189+
assert result["signature"] == self.data
190+
assert result["signature2"] == self.data1
191191

192192
def test_save_to_database(self):
193193
Base.metadata.drop_all(engine)
@@ -196,7 +196,7 @@ def test_save_to_database(self):
196196
myinput = TestInput()
197197
myinput.save_book_to_database(file_name=self.testfile, session=self.session, tables=[Signature, Signature2])
198198
array = pe.get_array(session=self.session, table=Signature)
199-
assert array == self.data
199+
self.assertEqual(array, self.data)
200200
array = pe.get_array(session=self.session, table=Signature2)
201201
assert array == self.data1
202202
self.session.close()

0 commit comments

Comments
 (0)