documentation and test update

This commit is contained in:
chfw 2014-11-19 23:54:44 +00:00
parent 4a55870162
commit 1c8f05f096
7 changed files with 23 additions and 17 deletions

View File

@ -10,6 +10,6 @@ install:
- python setup.py install
- pip install -r tests/requirements.txt --use-mirrors
script:
nosetests --rednose --with-cov
make test
after_success:
codecov

5
Makefile Normal file
View File

@ -0,0 +1,5 @@
all: test
test:
bash test.sh

1
test.bat Normal file
View File

@ -0,0 +1 @@
nosetests --with-cov --with-doctest --doctest-extension=.rst

1
test.sh Normal file
View File

@ -0,0 +1 @@
nosetests --rednose --with-cov --with-doctest --doctest-extension=.rst

View File

@ -1,7 +1,5 @@
import pyexcel
import json
import os
import datetime
def create_sample_file1(file):
@ -72,6 +70,7 @@ class PyexcelWriterBase:
w2.write_reader(r)
w2.close()
r2 = pyexcel.Reader(self.testfile2)
r2.format(int)
actual = pyexcel.utils.to_array(r2.rows())
assert actual == self.content
@ -108,7 +107,7 @@ class PyexcelMultipleSheetBase:
expected = [[u'X', u'Y', u'Z'], [1, 4, 7], [2, 5, 8], [3, 6, 9]]
assert data == expected
sheet3 = b["Sheet3"]
sheet3.become_series()
sheet3.name_columns_by_row(0)
data = pyexcel.utils.to_array(b["Sheet3"].rows())
expected = [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
assert data == expected
@ -139,14 +138,12 @@ class PyexcelMultipleSheetBase:
def test_random_access_operator(self):
r = pyexcel.BookReader(self.testfile)
value = r["Sheet1"][0][1]
value = r["Sheet1"][0,1]
assert value == 1
value = r["Sheet3"][0][1]
assert value == 'Y'
value = r["Sheet3"].become_series()[0][1]
assert value == 4
value = r["Sheet3"].become_sheet()[0][1]
value = r["Sheet3"][0,1]
assert value == 'Y'
r["Sheet3"].name_columns_by_row(0)
assert r["Sheet3"][0,1] == 4
class ODSCellTypes:

View File

@ -1,4 +1,5 @@
pyexcel
pyexcel-xl
nose
rednose
nose-cov

View File

@ -2,6 +2,7 @@ from base import PyexcelMultipleSheetBase
import pyexcel
import os
from pyexcel.ext import ods
from pyexcel.ext import xl
class TestOdsNxlsMultipleSheets(PyexcelMultipleSheetBase):
@ -61,7 +62,7 @@ class TestAddBooks:
self._write_test_file(self.testfile2)
def test_delete_sheets(self):
b1 = pyexcel.readers.Book(self.testfile)
b1 = pyexcel.load_book(self.testfile)
assert len(b1.sheet_names()) == 3
del b1["Sheet1"]
assert len(b1.sheet_names()) == 2
@ -80,7 +81,7 @@ class TestAddBooks:
def test_delete_sheets2(self):
"""repetitively delete first sheet"""
b1 = pyexcel.readers.Book(self.testfile)
b1 = pyexcel.load_book(self.testfile)
del b1[0]
assert len(b1.sheet_names()) == 2
del b1[0]
@ -108,7 +109,7 @@ class TestAddBooks:
def test_add_book1_in_place(self):
"""
test this scenario: book1 += book2
test this scenario book1 += book2
"""
b1 = pyexcel.BookReader(self.testfile)
b2 = pyexcel.BookReader(self.testfile2)
@ -126,7 +127,7 @@ class TestAddBooks:
def test_add_book2(self):
"""
test this scenario: book3 = book1 + sheet3
test this scenario book3 = book1 + sheet3
"""
b1 = pyexcel.BookReader(self.testfile)
b2 = pyexcel.BookReader(self.testfile2)
@ -144,7 +145,7 @@ class TestAddBooks:
def test_add_book2_in_place(self):
"""
test this scenario: book3 = book1 + sheet3
test this scenario book3 = book1 + sheet3
"""
b1 = pyexcel.BookReader(self.testfile)
b2 = pyexcel.BookReader(self.testfile2)
@ -162,7 +163,7 @@ class TestAddBooks:
def test_add_book3(self):
"""
test this scenario: book3 = sheet1 + sheet2
test this scenario book3 = sheet1 + sheet2
"""
b1 = pyexcel.BookReader(self.testfile)
b2 = pyexcel.BookReader(self.testfile2)
@ -175,7 +176,7 @@ class TestAddBooks:
def test_add_book4(self):
"""
test this scenario: book3 = sheet1 + book
test this scenario book3 = sheet1 + book
"""
b1 = pyexcel.BookReader(self.testfile)
b2 = pyexcel.BookReader(self.testfile2)