Skip to content

Commit 32984fe

Browse files
committed
@raises -> pytest.raises
1 parent a5f989f commit 32984fe

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

tests/test_bug_fixes.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from pyexcel_xls.xlsr import xldate_to_python_date
1515
from pyexcel_xls.xlsw import XLSWriter as Writer
1616

17-
from nose.tools import eq_, raises
1817
import pytest
1918

2019
IN_TRAVIS = "TRAVIS" in os.environ
@@ -66,9 +65,9 @@ def custom_row_renderer(row):
6665
save_data("test.xls", {"sheet": data_gen()})
6766

6867

69-
@raises(IOError)
7068
def test_issue_13_empty_file_content():
71-
pe.get_sheet(file_content="", file_type="xls")
69+
with pytest.raises(IOError):
70+
pe.get_sheet(file_content="", file_type="xls")
7271

7372

7473
def test_issue_16_file_stream_has_no_getvalue():
@@ -107,13 +106,13 @@ def test_issue_151():
107106
assert "#N/A" == s[0, 0]
108107

109108

110-
@raises(NotImplementedError)
111109
def test_empty_book_pyexcel_issue_120():
112110
"""
113111
https://github.com/pyexcel/pyexcel/issues/120
114112
"""
115-
writer = Writer("fake.xls", "xls")
116-
writer.write({})
113+
with pytest.raises(NotImplementedError):
114+
writer = Writer("fake.xls", "xls")
115+
writer.write({})
117116

118117

119118
def test_pyexcel_issue_54():

tests/test_multiple_sheets.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pyexcel
55
from base import PyexcelMultipleSheetBase
66

7-
from nose.tools import raises
7+
import pytest
88

99
if sys.version_info[0] == 2 and sys.version_info[1] < 7:
1010
from ordereddict import OrderedDict
@@ -53,13 +53,13 @@ def test_load_a_single_sheet2(self):
5353
assert len(b1.sheet_names()) == 1
5454
assert b1["Sheet1"].to_array() == self.content["Sheet1"]
5555

56-
@raises(IndexError)
5756
def test_load_a_single_sheet3(self):
58-
pyexcel.get_book(file_name=self.testfile, sheet_index=10000)
57+
with pytest.raises(IndexError):
58+
pyexcel.get_book(file_name=self.testfile, sheet_index=10000)
5959

60-
@raises(ValueError)
6160
def test_load_a_single_sheet4(self):
62-
pyexcel.get_book(file_name=self.testfile, sheet_name="Not exist")
61+
with pytest.raises(ValueError):
62+
pyexcel.get_book(file_name=self.testfile, sheet_name="Not exist")
6363

6464
def test_delete_sheets(self):
6565
b1 = pyexcel.load_book(self.testfile)

0 commit comments

Comments
 (0)