File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1985,11 +1985,15 @@ def test_n_error(self, df_strings):
1985
1985
columns_with_errors = {'category_string' , 'string' }
1986
1986
columns_without_errors = list (set (df ) - columns_with_errors )
1987
1987
for column in columns_with_errors :
1988
+ dtype = df [column ].dtype
1988
1989
for columns in (column , ['group' , column ]):
1989
- with pytest .raises (TypeError ):
1990
+ msg_template = "Cannot use method '%s' with dtype %s"
1991
+ with pytest .raises (TypeError ) as exc_info :
1990
1992
df .nsmallest (2 , columns )
1991
- with pytest .raises (TypeError ):
1993
+ assert exc_info .value , msg_template % ('nsmallest' , dtype )
1994
+ with pytest .raises (TypeError ) as exc_info :
1992
1995
df .nlargest (2 , columns )
1996
+ assert exc_info .value , msg_template % ('nlargest' , dtype )
1993
1997
df .nsmallest (2 , columns_without_errors )
1994
1998
df .nsmallest (2 , ['int' , 'string' ]) # int column is unique => OK
1995
1999
You can’t perform that action at this time.
0 commit comments