update test cases

This commit is contained in:
chfw 2016-10-24 22:26:43 +01:00
parent 8a0b42bcfc
commit ee288f6972
3 changed files with 13 additions and 12 deletions

View File

@ -1,7 +1,7 @@
import os
import pyexcel
from nose.tools import raises
import datetime
from nose.tools import raises, eq_
def create_sample_file1(file):
@ -26,7 +26,7 @@ class PyexcelHatWriterBase:
def test_series_table(self):
pyexcel.save_as(adict=self.content, dest_file_name=self.testfile)
r = pyexcel.get_sheet(file_name=self.testfile, name_columns_by_row=0)
assert r.dict == self.content
eq_(r.dict, self.content)
class PyexcelWriterBase:

View File

@ -1,8 +1,8 @@
from base import PyexcelMultipleSheetBase
import pyexcel
import os
from nose.tools import raises
import sys
import pyexcel
from nose.tools import raises
from base import PyexcelMultipleSheetBase
if sys.version_info[0] == 2 and sys.version_info[1] < 7:
from ordereddict import OrderedDict
@ -42,7 +42,8 @@ class TestAddBooks:
3,3,3,3
"""
self.rows = 3
pyexcel.save_book_as(bookdict=self.content, dest_file_name=file)
pyexcel.save_book_as(bookdict=self.content,
dest_file_name=file)
def setUp(self):
self.testfile = "multiple1.ods"
@ -63,11 +64,11 @@ class TestAddBooks:
@raises(IndexError)
def test_load_a_single_sheet3(self):
pyexcel.load_book(self.testfile, sheet_index=10000)
pyexcel.get_book(file_name=self.testfile, sheet_index=10000)
@raises(ValueError)
def test_load_a_single_sheet4(self):
pyexcel.load_book(self.testfile, sheet_name="Not exist")
pyexcel.get_book(file_name=self.testfile, sheet_name="Not exist")
def test_delete_sheets(self):
b1 = pyexcel.load_book(self.testfile)

View File

@ -1,10 +1,10 @@
import os
from unittest import TestCase
from nose.tools import eq_
import pyexcel
from base import create_sample_file1
class TestStringIO(TestCase):
class TestStringIO:
def test_ods_stringio(self):
odsfile = "cute.ods"
@ -14,7 +14,7 @@ class TestStringIO(TestCase):
r = pyexcel.get_sheet(file_type="ods", file_content=content)
result = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 1.1, 1]
actual = list(r.enumerate())
self.assertEqual(result, actual)
eq_(result, actual)
if os.path.exists(odsfile):
os.unlink(odsfile)
@ -27,4 +27,4 @@ class TestStringIO(TestCase):
r = pyexcel.get_sheet(file_type="ods", file_content=io.getvalue())
result = [1, 2, 3, 4, 5, 6]
actual = list(r.enumerate())
self.assertEqual(result, actual)
eq_(result, actual)