@@ -40,6 +40,9 @@ def ignore_xlrd_time_clock_warning():
40
40
marks = [
41
41
td .skip_if_no ("xlrd" ),
42
42
pytest .mark .filterwarnings ("ignore:.*(tree\\ .iter|html argument)" ),
43
+ pytest .mark .filterwarnings (
44
+ 'ignore:The Excel reader engine "xlrd" is deprecated,'
45
+ ),
43
46
],
44
47
),
45
48
pytest .param (
@@ -52,8 +55,8 @@ def ignore_xlrd_time_clock_warning():
52
55
pytest .param (
53
56
None ,
54
57
marks = [
55
- td .skip_if_no ("xlrd " ),
56
- pytest .mark .filterwarnings ("ignore:.*(tree \\ .iter| html argument) " ),
58
+ td .skip_if_no ("openpyxl " ),
59
+ pytest .mark .filterwarnings ("ignore:.*html argument" ),
57
60
],
58
61
),
59
62
pytest .param ("pyxlsb" , marks = td .skip_if_no ("pyxlsb" )),
@@ -69,6 +72,8 @@ def _is_valid_engine_ext_pair(engine, read_ext: str) -> bool:
69
72
engine = engine .values [0 ]
70
73
if engine == "openpyxl" and read_ext == ".xls" :
71
74
return False
75
+ if engine is None and read_ext == ".xls" :
76
+ return False
72
77
if engine == "odf" and read_ext != ".ods" :
73
78
return False
74
79
if read_ext == ".ods" and engine != "odf" :
@@ -579,7 +584,7 @@ def test_date_conversion_overflow(self, read_ext):
579
584
columns = ["DateColWithBigInt" , "StringCol" ],
580
585
)
581
586
582
- if pd .read_excel .keywords ["engine" ] == "openpyxl" :
587
+ if pd .read_excel .keywords ["engine" ] in [ "openpyxl" , None ] :
583
588
pytest .xfail ("Maybe not supported by openpyxl" )
584
589
585
590
result = pd .read_excel ("testdateoverflow" + read_ext )
@@ -962,12 +967,28 @@ def test_read_excel_squeeze(self, read_ext):
962
967
expected = pd .Series ([1 , 2 , 3 ], name = "a" )
963
968
tm .assert_series_equal (actual , expected )
964
969
965
- def test_deprecated_kwargs (self , read_ext ):
970
+ def test_deprecated_kwargs (self , engine , read_ext ):
971
+ if engine == "xlrd" :
972
+ pytest .skip ("Use of xlrd engine produces a FutureWarning as well" )
973
+
966
974
with tm .assert_produces_warning (FutureWarning , raise_on_extra_warnings = False ):
967
975
pd .read_excel ("test1" + read_ext , "Sheet1" , 0 )
968
976
969
977
pd .read_excel ("test1" + read_ext )
970
978
979
+ def test_excel_high_surrogate (self , engine , read_ext ):
980
+ # GH 23809
981
+ if read_ext != ".xlsx" :
982
+ pytest .skip ("Test is only applicable to .xlsx file" )
983
+ if engine in ["openpyxl" , None ]:
984
+ pytest .skip ("Test does not work for openpyxl" )
985
+
986
+ expected = pd .DataFrame (["\udc88 " ], columns = ["Column1" ])
987
+
988
+ # should not produce a segmentation violation
989
+ actual = pd .read_excel ("high_surrogate.xlsx" )
990
+ tm .assert_frame_equal (expected , actual )
991
+
971
992
972
993
class TestExcelFileRead :
973
994
@pytest .fixture (autouse = True )
@@ -1123,14 +1144,6 @@ def test_excel_read_binary(self, engine, read_ext):
1123
1144
actual = pd .read_excel (data , engine = engine )
1124
1145
tm .assert_frame_equal (expected , actual )
1125
1146
1126
- def test_excel_high_surrogate (self , engine ):
1127
- # GH 23809
1128
- expected = pd .DataFrame (["\udc88 " ], columns = ["Column1" ])
1129
-
1130
- # should not produce a segmentation violation
1131
- actual = pd .read_excel ("high_surrogate.xlsx" )
1132
- tm .assert_frame_equal (expected , actual )
1133
-
1134
1147
@pytest .mark .parametrize ("filename" , ["df_empty.xlsx" , "df_equals.xlsx" ])
1135
1148
def test_header_with_index_col (self , engine , filename ):
1136
1149
# GH 33476
0 commit comments