Skip to content

Commit e79e9a1

Browse files
committed
amended test
1 parent 6c98fa3 commit e79e9a1

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

pandas/tests/io/excel/test_readers.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -1278,12 +1278,23 @@ def test_ignore_chartsheets_by_int(self, request, read_ext):
12781278
):
12791279
pd.read_excel("chartsheet" + read_ext, sheet_name=1)
12801280

1281-
def test_dtype_dict(self, read_ext):
1281+
def test_dtype_dict_unchanged_with_duplicate_columns(self, read_ext):
1282+
# GH 42462
1283+
12821284
filename = "test_common_headers" + read_ext
12831285
dtype_dict = {"a": str, "b": str, "c": str}
12841286
dtype_dict_copy = dtype_dict.copy()
1285-
pd.read_excel(filename, dtype=dtype_dict)
1287+
read = pd.read_excel(filename, dtype=dtype_dict)
1288+
expected = DataFrame(
1289+
{
1290+
"a": ["1", "2", "3"],
1291+
"a.1": ["1", "2", "3"],
1292+
"b": ["b1", "b2", "b3"],
1293+
"c": ["c1", "c2", "c3"],
1294+
}
1295+
)
12861296
assert dtype_dict == dtype_dict_copy, "dtype dict changed"
1297+
tm.assert_frame_equal(read, expected)
12871298

12881299

12891300
class TestExcelFileRead:

0 commit comments

Comments
 (0)