File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -1638,7 +1638,11 @@ def _has_valid_setitem_indexer(self, indexer) -> bool:
1638
1638
)
1639
1639
1640
1640
# Check for Series boolean indexer
1641
- if com .is_bool_indexer (indexer ) and hasattr (indexer , "index" ) and isinstance (indexer .index , Index ):
1641
+ if (
1642
+ com .is_bool_indexer (indexer )
1643
+ and hasattr (indexer , "index" )
1644
+ and isinstance (indexer .index , Index )
1645
+ ):
1642
1646
if indexer .index .inferred_type == "integer" :
1643
1647
raise NotImplementedError (
1644
1648
"iLocation based boolean "
Original file line number Diff line number Diff line change @@ -408,16 +408,18 @@ def test_getitem_frozenset_unique_in_column(self):
408
408
tm .assert_series_equal (result , expected )
409
409
410
410
def test_series_boolean_indexer_iloc_consistency (self ):
411
- # GH#60994 - Test consistency between __getitem__ and __setitem__ for Series boolean indexers
411
+ # GH#60994 - Test consistency between __getitem__ and __setitem__ for Series
412
+ # boolean indexers
412
413
ser = Series ([0 , 1 , 2 ])
413
414
mask = Series ([True , False , False ])
414
-
415
+
415
416
# __getitem__ should raise NotImplementedError
416
- with pytest .raises (NotImplementedError , match = "iLocation based boolean indexing on an integer type is not available" ):
417
+ msg = "iLocation based boolean indexing on an integer type is not available"
418
+ with pytest .raises (NotImplementedError , match = msg ):
417
419
ser .iloc [mask ]
418
-
420
+
419
421
# __setitem__ should also raise NotImplementedError for consistency
420
- with pytest .raises (NotImplementedError , match = "iLocation based boolean indexing on an integer type is not available" ):
422
+ with pytest .raises (NotImplementedError , match = msg ):
421
423
ser .iloc [mask ] = 10
422
424
423
425
You can’t perform that action at this time.
0 commit comments