Skip to content

Commit 5babe24

Browse files
committed
Don't check stacklevel on tests.
This code can be reached from multiple places. Keeping up with the stacklevel seems like overkill here.
1 parent 7b6a5ad commit 5babe24

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pandas/tests/groupby/test_grouping.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,8 @@ def test_default_observed_deprecated(self):
698698
df.x = df.x.astype('category')
699699
df.y = df.x.astype('category')
700700

701-
with tm.assert_produces_warning(expected_warning=FutureWarning):
701+
with tm.assert_produces_warning(expected_warning=FutureWarning,
702+
check_stacklevel=False):
702703
df.groupby(['x', 'y'])
703704

704705
with pytest.warns(None) as any_warnings:
@@ -708,7 +709,8 @@ def test_default_observed_deprecated(self):
708709

709710
cat = pd.Categorical(['A', 'B', 'C'], categories=['A', 'B', 'C', 'D'])
710711
s = Series(cat)
711-
with tm.assert_produces_warning(expected_warning=FutureWarning):
712+
with tm.assert_produces_warning(expected_warning=FutureWarning,
713+
check_stacklevel=False):
712714
s.groupby(cat)
713715

714716

pandas/tests/reshape/test_pivot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2077,7 +2077,8 @@ def agg(l):
20772077
foo.pivot_table("notpresent", "X", "Y", aggfunc=agg)
20782078

20792079
def test_pivot_table_observed_deprecated_default(self):
2080-
with tm.assert_produces_warning(FutureWarning):
2080+
with tm.assert_produces_warning(FutureWarning,
2081+
check_stacklevel=False):
20812082
# make sure we actually have a category to warn on
20822083
self.data.A = self.data.A.astype('category')
20832084
self.data.pivot_table(values="D", index=["A", "B"],

0 commit comments

Comments
 (0)