Skip to content

Commit

Permalink
Improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
chfw committed Dec 22, 2016
1 parent cdd7400 commit 0a4cbc1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
5 changes: 4 additions & 1 deletion pyexcel_io/book.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ def write(self, incoming_dict):
sheet_writer.close()

def create_sheet(self, sheet_name):
pass
"""
implement this method for easy extension
"""
raise NotImplementedError("Please implement create_sheet()")


def _convert_content_to_stream(file_content, file_type):
Expand Down
2 changes: 1 addition & 1 deletion pyexcel_io/sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def write_row(self, array):
"""
write a row into the file
"""
raise NotImplementedError("Please implement write_row")
raise NotImplementedError("Please implement write_row()")

def write_array(self, table):
"""
Expand Down
20 changes: 18 additions & 2 deletions tests/test_base.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
from pyexcel_io.sheet import (
SheetReader,
SheetWriter, NamedContent
SheetReader, SheetWriter, NamedContent
)
from pyexcel_io.book import BookWriter
from pyexcel_io.utils import is_empty_array
from nose.tools import raises


@raises(NotImplementedError)
def test_book_writer():
book = BookWriter()
book.create_sheet("test")


def test_is_empty_array():
a = ["", "", "", ""]
assert is_empty_array(a) is True
Expand Down Expand Up @@ -47,6 +53,16 @@ def test_abstractness(self):
reader = SheetReader("test")
reader.cell_value(1, 2)

@raises(NotImplementedError)
def test_number_of_columns(self):
reader = SheetReader("test")
reader.number_of_columns()

@raises(NotImplementedError)
def test_number_of_rows(self):
reader = SheetReader("test")
reader.number_of_rows()

def test_to_array(self):
name = "test"

Expand Down

0 comments on commit 0a4cbc1

Please sign in to comment.