Skip to content

Commit d8be323

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 d56fc86 commit d8be323

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
@@ -710,7 +710,8 @@ def test_default_observed_deprecated(self):
710710
df.x = df.x.astype('category')
711711
df.y = df.x.astype('category')
712712

713-
with tm.assert_produces_warning(expected_warning=FutureWarning):
713+
with tm.assert_produces_warning(expected_warning=FutureWarning,
714+
check_stacklevel=False):
714715
df.groupby(['x', 'y'])
715716

716717
with pytest.warns(None) as any_warnings:
@@ -720,7 +721,8 @@ def test_default_observed_deprecated(self):
720721

721722
cat = pd.Categorical(['A', 'B', 'C'], categories=['A', 'B', 'C', 'D'])
722723
s = Series(cat)
723-
with tm.assert_produces_warning(expected_warning=FutureWarning):
724+
with tm.assert_produces_warning(expected_warning=FutureWarning,
725+
check_stacklevel=False):
724726
s.groupby(cat)
725727

726728

pandas/tests/reshape/test_pivot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2188,7 +2188,8 @@ def test_pivot_index_list_values_none_immutable_args(self):
21882188
assert columns == ["lev3"]
21892189

21902190
def test_pivot_table_observed_deprecated_default(self):
2191-
with tm.assert_produces_warning(FutureWarning):
2191+
with tm.assert_produces_warning(FutureWarning,
2192+
check_stacklevel=False):
21922193
# make sure we actually have a category to warn on
21932194
self.data.A = self.data.A.astype('category')
21942195
self.data.pivot_table(values="D", index=["A", "B"],

0 commit comments

Comments
 (0)