Skip to content

Commit 5bcf193

Browse files
Pass explicit engine for reading ods files
1 parent 4ea92e0 commit 5bcf193

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

pandas/tests/io/excel/test_writers.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,9 @@ def test_bytes_io(self, engine):
11751175
writer.save()
11761176

11771177
bio.seek(0)
1178-
reread_df = pd.read_excel(bio, index_col=0)
1178+
if engine != "odf":
1179+
engine = None
1180+
reread_df = pd.read_excel(bio, engine=engine, index_col=0)
11791181
tm.assert_frame_equal(df, reread_df)
11801182

11811183
def test_write_lists_dict(self, path):
@@ -1219,16 +1221,20 @@ def test_path_path_lib(self, engine, ext):
12191221
df = tm.makeDataFrame()
12201222
writer = partial(df.to_excel, engine=engine)
12211223

1222-
reader = partial(pd.read_excel, index_col=0)
1223-
result = tm.round_trip_pathlib(writer, reader, path=f"foo.{ext}")
1224+
if engine != "odf":
1225+
engine = None
1226+
reader = partial(pd.read_excel, engine=engine, index_col=0)
1227+
result = tm.round_trip_pathlib(writer, reader, path=f"foo{ext}")
12241228
tm.assert_frame_equal(result, df)
12251229

12261230
def test_path_local_path(self, engine, ext):
12271231
df = tm.makeDataFrame()
12281232
writer = partial(df.to_excel, engine=engine)
12291233

1230-
reader = partial(pd.read_excel, index_col=0)
1231-
result = tm.round_trip_pathlib(writer, reader, path=f"foo.{ext}")
1234+
if engine != "odf":
1235+
engine = None
1236+
reader = partial(pd.read_excel, engine=engine, index_col=0)
1237+
result = tm.round_trip_localpath(writer, reader, path=f"foo{ext}")
12321238
tm.assert_frame_equal(result, df)
12331239

12341240
def test_merged_cell_custom_objects(self, merge_cells, path):

0 commit comments

Comments
 (0)