@@ -342,15 +342,15 @@ def test_excel_passes_na(self, ext):
342
342
tm .assert_frame_equal (parsed , expected )
343
343
344
344
@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 ):
346
347
# gh-17964
347
348
excel = self .get_excelfile ('test1' , ext )
348
349
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 )
354
354
355
355
@td .skip_if_no ('xlrd' , '1.0.1' ) # GH-22682
356
356
def test_excel_table_sheet_by_index (self , ext ):
@@ -588,32 +588,20 @@ def test_sheet_name_and_sheetname(self, ext):
588
588
df_ref = self .get_csv_refdf (filename )
589
589
df1 = self .get_exceldf (filename , ext ,
590
590
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 )
595
594
596
595
excel = self .get_excelfile (filename , ext )
597
596
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 )
601
599
602
600
tm .assert_frame_equal (df1 , df_ref , check_names = False )
603
601
tm .assert_frame_equal (df2 , df_ref , check_names = False )
604
602
tm .assert_frame_equal (df1_parse , df_ref , check_names = False )
605
603
tm .assert_frame_equal (df2_parse , df_ref , check_names = False )
606
604
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
-
617
605
def test_excel_read_buffer (self , ext ):
618
606
619
607
pth = os .path .join (self .dirpath , 'test1' + ext )
0 commit comments