@@ -608,29 +608,29 @@ def test_getitem_guess_axis(array):
608
608
assert_array_equal (array [g ], raw [..., [0 , 4 , 8 ]])
609
609
610
610
# key with duplicate axes
611
- with pytest .raises (ValueError , message = "key has several values for axis: age" ):
611
+ with pytest .raises (ValueError , match = "key has several values for axis: age" ):
612
612
array [[1 , 2 ], [3 , 4 ]]
613
613
614
614
# key with invalid label (ie label not found on any axis)
615
- with pytest .raises (ValueError , message = "999 is not a valid label for any axis" ):
615
+ with pytest .raises (ValueError , match = "999 is not a valid label for any axis" ):
616
616
array [[1 , 2 ], 999 ]
617
617
618
618
# key with invalid label list (ie list of labels not found on any axis)
619
- with pytest .raises (ValueError , message = r"\[998, 999\] is not a valid label for any axis" ):
619
+ with pytest .raises (ValueError , match = r"\[998, 999\] is not a valid label for any axis" ):
620
620
array [[1 , 2 ], [998 , 999 ]]
621
621
622
622
# key with partial invalid list (ie list containing a label not found
623
623
# on any axis)
624
624
# FIXME: the message should be the same as for 999, 4 (ie it should NOT mention age).
625
- with pytest .raises (ValueError , message = r"age\[3, 999\] is not a valid label for any axis" ):
625
+ with pytest .raises (ValueError , match = r"age\[3, 999\] is not a valid label for any axis" ):
626
626
array [[1 , 2 ], [3 , 999 ]]
627
627
628
- with pytest .raises (ValueError , message = r"\[999, 4\] is not a valid label for any axis" ):
628
+ with pytest .raises (ValueError , match = r"\[999, 4\] is not a valid label for any axis" ):
629
629
array [[1 , 2 ], [999 , 4 ]]
630
630
631
631
# ambiguous key
632
632
arr = ndtest ("a=l0,l1;b=l1,l2" )
633
- with pytest .raises (ValueError , message = r"l1 is ambiguous \(valid in a, b\)" ):
633
+ with pytest .raises (ValueError , match = r"l1 is ambiguous \(valid in a, b\)" ):
634
634
arr ['l1' ]
635
635
636
636
# ambiguous key disambiguated via string
@@ -671,7 +671,7 @@ def test_getitem_positional_group(array):
671
671
assert_array_equal (array [..., lipro159 ], raw [..., [0 , 4 , 8 ]])
672
672
673
673
# key with duplicate axes
674
- with pytest .raises (ValueError , message = "key has several values for axis: age" ):
674
+ with pytest .raises (ValueError , match = "key has several values for axis: age" ):
675
675
array [age .i [1 , 2 ], age .i [3 , 4 ]]
676
676
677
677
@@ -716,7 +716,7 @@ def test_getitem_abstract_positional(array):
716
716
assert_array_equal (array [..., lipro159 ], raw [..., [0 , 4 , 8 ]])
717
717
718
718
# key with duplicate axes
719
- with pytest .raises (ValueError , message = "key has several values for axis: age" ):
719
+ with pytest .raises (ValueError , match = "key has several values for axis: age" ):
720
720
array [X .age .i [2 , 3 ], X .age .i [1 , 5 ]]
721
721
722
722
@@ -2319,7 +2319,7 @@ def test_sum_with_groups_from_other_axis(small_array):
2319
2319
# use a group (from another axis) which is incompatible with the axis of
2320
2320
# the same name in the array
2321
2321
lipro4 = Axis ('lipro=P01,P03,P16' )
2322
- with pytest .raises (ValueError , message = r"lipro\['P01', 'P16'\] is not a valid label for any axis" ):
2322
+ with pytest .raises (ValueError , match = r"lipro\['P01', 'P16'\] is not a valid label for any axis" ):
2323
2323
small_array .sum (lipro4 ['P01,P16' ])
2324
2324
2325
2325
@@ -3237,8 +3237,8 @@ def test_read_excel_xlwings():
3237
3237
# invalid keyword argument #
3238
3238
##############################
3239
3239
3240
- with pytest .raises (TypeError , message = "'dtype' is an invalid keyword argument for this function "
3241
- "when using the xlwings backend" ):
3240
+ with pytest .raises (TypeError , match = "'dtype' is an invalid keyword argument for this function "
3241
+ "when using the xlwings backend" ):
3242
3242
read_excel (inputpath ('test.xlsx' ), engine = 'xlwings' , dtype = float )
3243
3243
3244
3244
#################
@@ -4064,7 +4064,7 @@ def test_to_excel_xlwings(tmpdir):
4064
4064
# sheet name of 31 characters (= maximum authorized length)
4065
4065
a3 .to_excel (fpath , "sheetname_of_exactly_31_chars__" , engine = 'xlwings' )
4066
4066
# sheet name longer than 31 characters
4067
- with pytest .raises (ValueError , message = "Sheet names cannot exceed 31 characters" ):
4067
+ with pytest .raises (ValueError , match = "Sheet names cannot exceed 31 characters" ):
4068
4068
a3 .to_excel (fpath , "sheetname_longer_than_31_characters" , engine = 'xlwings' )
4069
4069
4070
4070
0 commit comments