Skip to content

Commit b475e7e

Browse files
committed
BUG: fix WARNING_CHECK_BROKEN checks
1 parent 856924d commit b475e7e

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

pandas/core/generic.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7072,7 +7072,7 @@ def fillna(
70727072
"""
70737073
inplace = validate_bool_kwarg(inplace, "inplace")
70747074
if inplace:
7075-
if not PYPY and WARNING_CHECK_BROKEN:
7075+
if not PYPY and not WARNING_CHECK_BROKEN:
70767076
if sys.getrefcount(self) <= REF_COUNT:
70777077
warnings.warn(
70787078
_chained_assignment_method_msg,
@@ -7303,7 +7303,7 @@ def ffill(
73037303
"""
73047304
inplace = validate_bool_kwarg(inplace, "inplace")
73057305
if inplace:
7306-
if not PYPY and WARNING_CHECK_BROKEN:
7306+
if not PYPY and not WARNING_CHECK_BROKEN:
73077307
if sys.getrefcount(self) <= REF_COUNT:
73087308
warnings.warn(
73097309
_chained_assignment_method_msg,
@@ -7443,7 +7443,7 @@ def bfill(
74437443
"""
74447444
inplace = validate_bool_kwarg(inplace, "inplace")
74457445
if inplace:
7446-
if not PYPY and WARNING_CHECK_BROKEN:
7446+
if not PYPY and not WARNING_CHECK_BROKEN:
74477447
if sys.getrefcount(self) <= REF_COUNT:
74487448
warnings.warn(
74497449
_chained_assignment_method_msg,
@@ -7528,7 +7528,7 @@ def replace(
75287528

75297529
inplace = validate_bool_kwarg(inplace, "inplace")
75307530
if inplace:
7531-
if not PYPY and WARNING_CHECK_BROKEN:
7531+
if not PYPY and not WARNING_CHECK_BROKEN:
75327532
if sys.getrefcount(self) <= REF_COUNT:
75337533
warnings.warn(
75347534
_chained_assignment_method_msg,
@@ -7891,7 +7891,7 @@ def interpolate(
78917891
inplace = validate_bool_kwarg(inplace, "inplace")
78927892

78937893
if inplace:
7894-
if not PYPY and WARNING_CHECK_BROKEN:
7894+
if not PYPY and not WARNING_CHECK_BROKEN:
78957895
if sys.getrefcount(self) <= REF_COUNT:
78967896
warnings.warn(
78977897
_chained_assignment_method_msg,
@@ -8475,7 +8475,7 @@ def clip(
84758475
inplace = validate_bool_kwarg(inplace, "inplace")
84768476

84778477
if inplace:
8478-
if not PYPY and WARNING_CHECK_BROKEN:
8478+
if not PYPY and not WARNING_CHECK_BROKEN:
84798479
if sys.getrefcount(self) <= REF_COUNT:
84808480
warnings.warn(
84818481
_chained_assignment_method_msg,
@@ -10084,7 +10084,7 @@ def where(
1008410084
"""
1008510085
inplace = validate_bool_kwarg(inplace, "inplace")
1008610086
if inplace:
10087-
if not PYPY and WARNING_CHECK_BROKEN:
10087+
if not PYPY and not WARNING_CHECK_BROKEN:
1008810088
if sys.getrefcount(self) <= REF_COUNT:
1008910089
warnings.warn(
1009010090
_chained_assignment_method_msg,
@@ -10148,7 +10148,7 @@ def mask(
1014810148
) -> Self | None:
1014910149
inplace = validate_bool_kwarg(inplace, "inplace")
1015010150
if inplace:
10151-
if not PYPY and WARNING_CHECK_BROKEN:
10151+
if not PYPY and not WARNING_CHECK_BROKEN:
1015210152
if sys.getrefcount(self) <= REF_COUNT:
1015310153
warnings.warn(
1015410154
_chained_assignment_method_msg,

pandas/tests/copy_view/test_chained_assignment_deprecation.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import numpy as np
22
import pytest
33

4+
from pandas.compat import WARNING_CHECK_BROKEN
45
from pandas.errors import ChainedAssignmentError
56

67
from pandas import DataFrame
@@ -17,6 +18,8 @@ def test_series_setitem(indexer):
1718

1819
# using custom check instead of tm.assert_produces_warning because that doesn't
1920
# fail if multiple warnings are raised
21+
if WARNING_CHECK_BROKEN:
22+
return
2023
with pytest.warns() as record: # noqa: TID251
2124
df["a"][indexer] = 0
2225
assert len(record) == 1

0 commit comments

Comments
 (0)