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:
16381638 )
16391639
16401640 # 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+ ):
16421646 if indexer .index .inferred_type == "integer" :
16431647 raise NotImplementedError (
16441648 "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):
408408 tm .assert_series_equal (result , expected )
409409
410410 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
412413 ser = Series ([0 , 1 , 2 ])
413414 mask = Series ([True , False , False ])
414-
415+
415416 # __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 ):
417419 ser .iloc [mask ]
418-
420+
419421 # __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 ):
421423 ser .iloc [mask ] = 10
422424
423425
You can’t perform that action at this time.
0 commit comments