@@ -85,6 +85,30 @@ def test_write_cells_merge_styled(ext):
8585 assert xcell_a2 .font == openpyxl_sty_merged
8686
8787
88+ @pytest .mark .parametrize ("write_only" , [True , False ])
89+ def test_kwargs (ext , write_only ):
90+ # GH 42286
91+ # openpyxl doesn't utilize kwargs, only test that supplying a kwarg works
92+ kwargs = {"write_only" : write_only }
93+ with tm .ensure_clean (ext ) as f :
94+ msg = re .escape ("Use of **kwargs is deprecated" )
95+ with tm .assert_produces_warning (FutureWarning , match = msg ):
96+ with ExcelWriter (f , engine = "openpyxl" , ** kwargs ) as writer :
97+ # ExcelWriter won't allow us to close without writing something
98+ DataFrame ().to_excel (writer )
99+
100+
101+ @pytest .mark .parametrize ("write_only" , [True , False ])
102+ def test_engine_kwargs (ext , write_only ):
103+ # GH 42286
104+ # openpyxl doesn't utilize kwargs, only test that supplying a engine_kwarg works
105+ engine_kwargs = {"write_only" : write_only }
106+ with tm .ensure_clean (ext ) as f :
107+ with ExcelWriter (f , engine = "openpyxl" , engine_kwargs = engine_kwargs ) as writer :
108+ # ExcelWriter won't allow us to close without writing something
109+ DataFrame ().to_excel (writer )
110+
111+
88112@pytest .mark .parametrize (
89113 "mode,expected" , [("w" , ["baz" ]), ("a" , ["foo" , "bar" , "baz" ])]
90114)
0 commit comments