@@ -53,8 +53,8 @@ def test_scalar_error(self, index_func):
53
53
s .iloc [3.0 ]
54
54
55
55
msg = (
56
- "cannot do positional indexing on {klass } with these "
57
- r"indexers \[3\.0\] of type float" . format ( klass = type ( i ). __name__ )
56
+ fr "cannot do positional indexing on { type ( i ). __name__ } with these "
57
+ r"indexers \[3\.0\] of type float"
58
58
)
59
59
with pytest .raises (TypeError , match = msg ):
60
60
s .iloc [3.0 ] = 0
@@ -95,10 +95,10 @@ def test_scalar_non_numeric(self, index_func):
95
95
error = TypeError
96
96
msg = (
97
97
r"cannot do (label|positional) indexing "
98
- r "on {klass } with these indexers \[3\.0\] of "
98
+ fr "on { type ( i ). __name__ } with these indexers \[3\.0\] of "
99
99
r"type float|"
100
100
"Cannot index by location index with a "
101
- "non-integer key" . format ( klass = type ( i ). __name__ )
101
+ "non-integer key"
102
102
)
103
103
with pytest .raises (error , match = msg ):
104
104
idxr (s )[3.0 ]
@@ -116,8 +116,8 @@ def test_scalar_non_numeric(self, index_func):
116
116
error = TypeError
117
117
msg = (
118
118
r"cannot do (label|positional) indexing "
119
- r "on {klass } with these indexers \[3\.0\] of "
120
- r "type float". format ( klass = type ( i ). __name__ )
119
+ fr "on { type ( i ). __name__ } with these indexers \[3\.0\] of "
120
+ "type float"
121
121
)
122
122
with pytest .raises (error , match = msg ):
123
123
s .loc [3.0 ]
@@ -128,8 +128,8 @@ def test_scalar_non_numeric(self, index_func):
128
128
# setting with a float fails with iloc
129
129
msg = (
130
130
r"cannot do (label|positional) indexing "
131
- r "on {klass } with these indexers \[3\.0\] of "
132
- r "type float". format ( klass = type ( i ). __name__ )
131
+ fr "on { type ( i ). __name__ } with these indexers \[3\.0\] of "
132
+ "type float"
133
133
)
134
134
with pytest .raises (TypeError , match = msg ):
135
135
s .iloc [3.0 ] = 0
@@ -165,8 +165,8 @@ def test_scalar_non_numeric(self, index_func):
165
165
s [3 ]
166
166
msg = (
167
167
r"cannot do (label|positional) indexing "
168
- r "on {klass } with these indexers \[3\.0\] of "
169
- r "type float". format ( klass = type ( i ). __name__ )
168
+ fr "on { type ( i ). __name__ } with these indexers \[3\.0\] of "
169
+ "type float"
170
170
)
171
171
with pytest .raises (TypeError , match = msg ):
172
172
s [3.0 ]
@@ -181,12 +181,10 @@ def test_scalar_with_mixed(self):
181
181
for idxr in [lambda x : x , lambda x : x .iloc ]:
182
182
183
183
msg = (
184
- r "cannot do label indexing "
185
- r "on {klass } with these indexers \[1\.0\] of "
184
+ "cannot do label indexing "
185
+ fr "on { Index . __name__ } with these indexers \[1\.0\] of "
186
186
r"type float|"
187
- "Cannot index by location index with a non-integer key" .format (
188
- klass = Index .__name__
189
- )
187
+ "Cannot index by location index with a non-integer key"
190
188
)
191
189
with pytest .raises (TypeError , match = msg ):
192
190
idxr (s2 )[1.0 ]
@@ -203,9 +201,9 @@ def test_scalar_with_mixed(self):
203
201
for idxr in [lambda x : x ]:
204
202
205
203
msg = (
206
- r "cannot do label indexing "
207
- r "on {klass } with these indexers \[1\.0\] of "
208
- r "type float". format ( klass = Index . __name__ )
204
+ "cannot do label indexing "
205
+ fr "on { Index . __name__ } with these indexers \[1\.0\] of "
206
+ "type float"
209
207
)
210
208
with pytest .raises (TypeError , match = msg ):
211
209
idxr (s3 )[1.0 ]
@@ -321,9 +319,9 @@ def test_scalar_float(self):
321
319
s .iloc [3.0 ]
322
320
323
321
msg = (
324
- r "cannot do positional indexing "
325
- r "on {klass } with these indexers \[3\.0\] of "
326
- r "type float". format ( klass = Float64Index . __name__ )
322
+ "cannot do positional indexing "
323
+ fr "on { Float64Index . __name__ } with these indexers \[3\.0\] of "
324
+ "type float"
327
325
)
328
326
with pytest .raises (TypeError , match = msg ):
329
327
s2 .iloc [3.0 ] = 0
@@ -355,8 +353,8 @@ def test_slice_non_numeric(self, index_func):
355
353
356
354
msg = (
357
355
"cannot do positional indexing "
358
- r "on {klass } with these indexers \[(3|4)\.0\] of "
359
- "type float" . format ( klass = type ( index ). __name__ )
356
+ fr "on { type ( index ). __name__ } with these indexers \[(3|4)\.0\] of "
357
+ "type float"
360
358
)
361
359
with pytest .raises (TypeError , match = msg ):
362
360
s .iloc [l ]
@@ -365,9 +363,9 @@ def test_slice_non_numeric(self, index_func):
365
363
366
364
msg = (
367
365
"cannot do (slice|positional) indexing "
368
- r "on {klass } with these indexers "
366
+ fr "on { type ( index ). __name__ } with these indexers "
369
367
r"\[(3|4)(\.0)?\] "
370
- r"of type (float|int)" . format ( klass = type ( index ). __name__ )
368
+ r"of type (float|int)"
371
369
)
372
370
with pytest .raises (TypeError , match = msg ):
373
371
idxr (s )[l ]
@@ -377,18 +375,18 @@ def test_slice_non_numeric(self, index_func):
377
375
378
376
msg = (
379
377
"cannot do positional indexing "
380
- r "on {klass } with these indexers \[(3|4)\.0\] of "
381
- "type float" . format ( klass = type ( index ). __name__ )
378
+ fr "on { type ( index ). __name__ } with these indexers \[(3|4)\.0\] of "
379
+ "type float"
382
380
)
383
381
with pytest .raises (TypeError , match = msg ):
384
382
s .iloc [l ] = 0
385
383
386
384
for idxr in [lambda x : x .loc , lambda x : x .iloc , lambda x : x ]:
387
385
msg = (
388
386
"cannot do (slice|positional) indexing "
389
- r "on {klass } with these indexers "
387
+ fr "on { type ( index ). __name__ } with these indexers "
390
388
r"\[(3|4)(\.0)?\] "
391
- r"of type (float|int)" . format ( klass = type ( index ). __name__ )
389
+ r"of type (float|int)"
392
390
)
393
391
with pytest .raises (TypeError , match = msg ):
394
392
idxr (s )[l ] = 0
@@ -427,8 +425,8 @@ def test_slice_integer(self):
427
425
# positional indexing
428
426
msg = (
429
427
"cannot do slice indexing "
430
- r "on {klass } with these indexers \[(3|4)\.0\] of "
431
- "type float" . format ( klass = type ( index ). __name__ )
428
+ fr "on { type ( index ). __name__ } with these indexers \[(3|4)\.0\] of "
429
+ "type float"
432
430
)
433
431
with pytest .raises (TypeError , match = msg ):
434
432
s [l ]
@@ -451,8 +449,8 @@ def test_slice_integer(self):
451
449
# positional indexing
452
450
msg = (
453
451
"cannot do slice indexing "
454
- r "on {klass } with these indexers \[-6\.0\] of "
455
- "type float" . format ( klass = type ( index ). __name__ )
452
+ fr "on { type ( index ). __name__ } with these indexers \[-6\.0\] of "
453
+ "type float"
456
454
)
457
455
with pytest .raises (TypeError , match = msg ):
458
456
s [slice (- 6.0 , 6.0 )]
@@ -477,8 +475,8 @@ def test_slice_integer(self):
477
475
# positional indexing
478
476
msg = (
479
477
"cannot do slice indexing "
480
- r "on {klass } with these indexers \[(2|3)\.5\] of "
481
- "type float" . format ( klass = type ( index ). __name__ )
478
+ fr "on { type ( index ). __name__ } with these indexers \[(2|3)\.5\] of "
479
+ "type float"
482
480
)
483
481
with pytest .raises (TypeError , match = msg ):
484
482
s [l ]
@@ -495,8 +493,8 @@ def test_slice_integer(self):
495
493
# positional indexing
496
494
msg = (
497
495
"cannot do slice indexing "
498
- r "on {klass } with these indexers \[(3|4)\.0\] of "
499
- "type float" . format ( klass = type ( index ). __name__ )
496
+ fr "on { type ( index ). __name__ } with these indexers \[(3|4)\.0\] of "
497
+ "type float"
500
498
)
501
499
with pytest .raises (TypeError , match = msg ):
502
500
s [l ] = 0
@@ -518,8 +516,8 @@ def test_integer_positional_indexing(self):
518
516
klass = RangeIndex
519
517
msg = (
520
518
"cannot do (slice|positional) indexing "
521
- r "on {klass} with these indexers \[(2|4)\.0\] of "
522
- "type float" . format ( klass = klass . __name__ )
519
+ fr "on { klass . __name__ } with these indexers \[(2|4)\.0\] of "
520
+ "type float"
523
521
)
524
522
with pytest .raises (TypeError , match = msg ):
525
523
idxr (s )[l ]
@@ -546,8 +544,8 @@ def f(idxr):
546
544
# positional indexing
547
545
msg = (
548
546
"cannot do slice indexing "
549
- r "on {klass } with these indexers \[(0|1)\.0\] of "
550
- "type float" . format ( klass = type ( index ). __name__ )
547
+ fr "on { type ( index ). __name__ } with these indexers \[(0|1)\.0\] of "
548
+ "type float"
551
549
)
552
550
with pytest .raises (TypeError , match = msg ):
553
551
s [l ]
@@ -561,8 +559,8 @@ def f(idxr):
561
559
# positional indexing
562
560
msg = (
563
561
"cannot do slice indexing "
564
- r "on {klass } with these indexers \[-10\.0\] of "
565
- "type float" . format ( klass = type ( index ). __name__ )
562
+ fr "on { type ( index ). __name__ } with these indexers \[-10\.0\] of "
563
+ "type float"
566
564
)
567
565
with pytest .raises (TypeError , match = msg ):
568
566
s [slice (- 10.0 , 10.0 )]
@@ -580,8 +578,8 @@ def f(idxr):
580
578
# positional indexing
581
579
msg = (
582
580
"cannot do slice indexing "
583
- r "on {klass } with these indexers \[0\.5\] of "
584
- "type float" . format ( klass = type ( index ). __name__ )
581
+ fr "on { type ( index ). __name__ } with these indexers \[0\.5\] of "
582
+ "type float"
585
583
)
586
584
with pytest .raises (TypeError , match = msg ):
587
585
s [l ]
@@ -597,8 +595,8 @@ def f(idxr):
597
595
# positional indexing
598
596
msg = (
599
597
"cannot do slice indexing "
600
- r "on {klass } with these indexers \[(3|4)\.0\] of "
601
- "type float" . format ( klass = type ( index ). __name__ )
598
+ fr "on { type ( index ). __name__ } with these indexers \[(3|4)\.0\] of "
599
+ "type float"
602
600
)
603
601
with pytest .raises (TypeError , match = msg ):
604
602
s [l ] = 0
0 commit comments