@@ -454,7 +454,7 @@ def test_loc_to_fail2(self):
454
454
s .loc [- 1 ]
455
455
456
456
msg = (
457
- fr "\"None of \[NumericIndex\(\[-1, -2\], dtype='{ np .intp ().dtype } '\)\] are "
457
+ rf "\"None of \[NumericIndex\(\[-1, -2\], dtype='{ np .intp ().dtype } '\)\] are "
458
458
r"in the \[index\]\""
459
459
)
460
460
with pytest .raises (KeyError , match = msg ):
@@ -470,7 +470,7 @@ def test_loc_to_fail2(self):
470
470
471
471
s ["a" ] = 2
472
472
msg = (
473
- fr "\"None of \[NumericIndex\(\[-2\], dtype='{ np .intp ().dtype } '\)\] are "
473
+ rf "\"None of \[NumericIndex\(\[-2\], dtype='{ np .intp ().dtype } '\)\] are "
474
474
r"in the \[index\]\""
475
475
)
476
476
with pytest .raises (KeyError , match = msg ):
@@ -487,7 +487,7 @@ def test_loc_to_fail3(self):
487
487
df = DataFrame ([["a" ], ["b" ]], index = [1 , 2 ], columns = ["value" ])
488
488
489
489
msg = (
490
- fr "\"None of \[NumericIndex\(\[3\], dtype='{ np .intp ().dtype } '\)\] are "
490
+ rf "\"None of \[NumericIndex\(\[3\], dtype='{ np .intp ().dtype } '\)\] are "
491
491
r"in the \[index\]\""
492
492
)
493
493
with pytest .raises (KeyError , match = msg ):
@@ -504,12 +504,11 @@ def test_loc_getitem_list_with_fail(self):
504
504
505
505
s .loc [[2 ]]
506
506
507
- with pytest .raises (
508
- KeyError ,
509
- match = re .escape (
510
- f"\" None of [NumericIndex([3], dtype='{ np .intp ().dtype } ')] are in the [index]\" "
511
- ),
512
- ):
507
+ msg = (
508
+ f"\" None of [NumericIndex([3], dtype='{ np .intp ().dtype } ')] "
509
+ f"are in the [index]\" "
510
+ )
511
+ with pytest .raises (KeyError , match = re .escape (msg )):
513
512
s .loc [[3 ]]
514
513
515
514
# a non-match and a match
@@ -1213,7 +1212,7 @@ def test_loc_setitem_empty_append_raises(self):
1213
1212
df = DataFrame (columns = ["x" , "y" ])
1214
1213
df .index = df .index .astype (np .int64 )
1215
1214
msg = (
1216
- fr "None of \[NumericIndex\(\[0, 1\], dtype='{ np .intp ().dtype } '\)\] "
1215
+ rf "None of \[NumericIndex\(\[0, 1\], dtype='{ np .intp ().dtype } '\)\] "
1217
1216
r"are in the \[index\]"
1218
1217
)
1219
1218
with pytest .raises (KeyError , match = msg ):
0 commit comments