@@ -342,15 +342,15 @@ def test_excel_passes_na(self, ext):
342342 tm .assert_frame_equal (parsed , expected )
343343
344344 @td .skip_if_no ('xlrd' , '1.0.1' ) # GH-22682
345- def test_deprecated_sheetname (self , ext ):
345+ @pytest .mark .parametrize ('arg' , ['sheet' , 'sheetname' ])
346+ def test_unexpected_kwargs_raises (self , ext , arg ):
346347 # gh-17964
347348 excel = self .get_excelfile ('test1' , ext )
348349
349- with tm .assert_produces_warning (FutureWarning , check_stacklevel = False ):
350- read_excel (excel , sheetname = 'Sheet1' )
351-
352- with pytest .raises (TypeError ):
353- read_excel (excel , sheet = 'Sheet1' )
350+ kwarg = {arg : 'Sheet1' }
351+ msg = "unexpected keyword argument `{}`" .format (arg )
352+ with pytest .raises (TypeError , match = msg ):
353+ read_excel (excel , ** kwarg )
354354
355355 @td .skip_if_no ('xlrd' , '1.0.1' ) # GH-22682
356356 def test_excel_table_sheet_by_index (self , ext ):
@@ -588,32 +588,20 @@ def test_sheet_name_and_sheetname(self, ext):
588588 df_ref = self .get_csv_refdf (filename )
589589 df1 = self .get_exceldf (filename , ext ,
590590 sheet_name = sheet_name , index_col = 0 ) # doc
591- with tm .assert_produces_warning (FutureWarning , check_stacklevel = False ):
592- with ignore_xlrd_time_clock_warning ():
593- df2 = self .get_exceldf (filename , ext , index_col = 0 ,
594- sheetname = sheet_name ) # backward compat
591+ with ignore_xlrd_time_clock_warning ():
592+ df2 = self .get_exceldf (filename , ext , index_col = 0 ,
593+ sheet_name = sheet_name )
595594
596595 excel = self .get_excelfile (filename , ext )
597596 df1_parse = excel .parse (sheet_name = sheet_name , index_col = 0 ) # doc
598- with tm .assert_produces_warning (FutureWarning , check_stacklevel = False ):
599- df2_parse = excel .parse (index_col = 0 ,
600- sheetname = sheet_name ) # backward compat
597+ df2_parse = excel .parse (index_col = 0 ,
598+ sheet_name = sheet_name )
601599
602600 tm .assert_frame_equal (df1 , df_ref , check_names = False )
603601 tm .assert_frame_equal (df2 , df_ref , check_names = False )
604602 tm .assert_frame_equal (df1_parse , df_ref , check_names = False )
605603 tm .assert_frame_equal (df2_parse , df_ref , check_names = False )
606604
607- def test_sheet_name_both_raises (self , ext ):
608- with pytest .raises (TypeError , match = "Cannot specify both" ):
609- self .get_exceldf ('test1' , ext , sheetname = 'Sheet1' ,
610- sheet_name = 'Sheet1' )
611-
612- excel = self .get_excelfile ('test1' , ext )
613- with pytest .raises (TypeError , match = "Cannot specify both" ):
614- excel .parse (sheetname = 'Sheet1' ,
615- sheet_name = 'Sheet1' )
616-
617605 def test_excel_read_buffer (self , ext ):
618606
619607 pth = os .path .join (self .dirpath , 'test1' + ext )
0 commit comments