Skip to content

Commit c927fa9

Browse files
committed
Move ODFReader get_sheet exception testing code to its own function
that ends with _raises
1 parent b3d900f commit c927fa9

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

pandas/tests/io/test_excel.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2567,18 +2567,24 @@ def test_get_sheet(self):
25672567
pth = os.path.join(self.dirpath, 'datatypes.ods')
25682568
book = _ODFReader(pth)
25692569

2570+
assert len(book.sheet_names) == 1
2571+
assert book.sheet_names == ['Sheet1']
2572+
2573+
def test_get_sheet_raises(self):
2574+
from pandas.io.excel._odfreader import _ODFReader
2575+
2576+
pth = os.path.join(self.dirpath, 'datatypes.ods')
2577+
book = _ODFReader(pth)
2578+
25702579
with pytest.raises(ValueError):
2571-
book.get_sheet(3.14)
2580+
book._get_sheet(3.14)
25722581

25732582
with pytest.raises(ValueError):
25742583
book.get_sheet_by_name("Invalid Sheet 77")
25752584

25762585
with pytest.raises(IndexError):
25772586
book.get_sheet_by_index(-33)
25782587

2579-
assert len(book.sheet_names) == 1
2580-
assert book.sheet_names == ['Sheet1']
2581-
25822588
def test_read_types(self):
25832589
"""Make sure we read ODF data types correctly
25842590
"""

0 commit comments

Comments
 (0)