Skip to content

Commit 6b9525e

Browse files
author
Justine Kosinski
committed
TST: add assertions to check the shape and column levels of the DataFrame when reading an Excel file
1 parent 04cd920 commit 6b9525e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pandas/tests/io/excel/test_writers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,10 @@ def test_to_excel_multiindex_nan_in_columns(self, merge_cells, tmp_excel):
15221522

15231523
with ExcelFile(tmp_excel) as reader:
15241524
result = pd.read_excel(reader, index_col=0, header=[0, 1])
1525-
1525+
assert result.shape == df.shape
1526+
assert list(result.index) == list(df.index)
1527+
assert isinstance(result.columns, MultiIndex)
1528+
assert result.columns.nlevels == df.columns.nlevels
15261529
tm.assert_numpy_array_equal(result.to_numpy(), df.to_numpy())
15271530

15281531
@pytest.mark.parametrize("with_index", [True, False])

0 commit comments

Comments
 (0)