Skip to content

Commit 0de32ba

Browse files
committed
adjust for precommit
1 parent cd9b6a0 commit 0de32ba

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

pandas/core/indexing.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff 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 "

pandas/tests/frame/indexing/test_getitem.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)