Skip to content

Commit 75609da

Browse files
authored
TST: unnecessary check_stacklevel=False (#39901)
1 parent 68fe64b commit 75609da

File tree

16 files changed

+20
-20
lines changed

16 files changed

+20
-20
lines changed

pandas/tests/api/test_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@ def test_types(self):
5959
def test_deprecated_from_api_types(self):
6060

6161
for t in self.deprecated:
62-
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
62+
with tm.assert_produces_warning(FutureWarning):
6363
getattr(types, t)(1)

pandas/tests/apply/test_frame_transform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def test_transform_bad_dtype(op, frame_or_series):
206206

207207
# tshift is deprecated
208208
warn = None if op != "tshift" else FutureWarning
209-
with tm.assert_produces_warning(warn, check_stacklevel=False):
209+
with tm.assert_produces_warning(warn):
210210
with pytest.raises(ValueError, match=msg):
211211
obj.transform(op)
212212
with pytest.raises(ValueError, match=msg):

pandas/tests/dtypes/test_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ def test_astype_nansafe(val, typ):
724724

725725
msg = "Cannot convert NaT values to integer"
726726
with pytest.raises(ValueError, match=msg):
727-
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
727+
with tm.assert_produces_warning(FutureWarning):
728728
# datetimelike astype(int64) deprecated
729729
astype_nansafe(arr, dtype=typ)
730730

pandas/tests/frame/indexing/test_indexing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def test_getitem_boolean(
295295
# we are producing a warning that since the passed boolean
296296
# key is not the same as the given index, we will reindex
297297
# not sure this is really necessary
298-
with tm.assert_produces_warning(UserWarning, check_stacklevel=False):
298+
with tm.assert_produces_warning(UserWarning):
299299
indexer_obj = indexer_obj.reindex(datetime_frame.index[::-1])
300300
subframe_obj = datetime_frame[indexer_obj]
301301
tm.assert_frame_equal(subframe_obj, subframe)

pandas/tests/frame/methods/test_join.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def test_suppress_future_warning_with_sort_kw(sort_kw):
227227
if sort_kw is False:
228228
expected = expected.reindex(index=["c", "a", "b"])
229229

230-
with tm.assert_produces_warning(None, check_stacklevel=False):
230+
with tm.assert_produces_warning(None):
231231
result = a.join([b, c], how="outer", sort=sort_kw)
232232
tm.assert_frame_equal(result, expected)
233233

pandas/tests/frame/methods/test_sort_values.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ def test_sort_column_level_and_index_label(
845845
if len(levels) > 1:
846846
# Accessing multi-level columns that are not lexsorted raises a
847847
# performance warning
848-
with tm.assert_produces_warning(PerformanceWarning, check_stacklevel=False):
848+
with tm.assert_produces_warning(PerformanceWarning):
849849
tm.assert_frame_equal(result, expected)
850850
else:
851851
tm.assert_frame_equal(result, expected)

pandas/tests/frame/test_reductions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ def test_mode_sortwarning(self):
669669
df = DataFrame({"A": [np.nan, np.nan, "a", "a"]})
670670
expected = DataFrame({"A": ["a", np.nan]})
671671

672-
with tm.assert_produces_warning(UserWarning, check_stacklevel=False):
672+
with tm.assert_produces_warning(UserWarning):
673673
result = df.mode(dropna=False)
674674
result = result.sort_values(by="A").reset_index(drop=True)
675675

pandas/tests/indexes/test_any_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_hash_error(index):
3333

3434
def test_copy_dtype_deprecated(index):
3535
# GH#35853
36-
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
36+
with tm.assert_produces_warning(FutureWarning):
3737
index.copy(dtype=object)
3838

3939

pandas/tests/indexing/test_indexing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_getitem_ndarray_3d(self, index, frame_or_series, indexer_sli):
9292

9393
potential_errors = (IndexError, ValueError, NotImplementedError)
9494
with pytest.raises(potential_errors, match=msg):
95-
with tm.assert_produces_warning(DeprecationWarning, check_stacklevel=False):
95+
with tm.assert_produces_warning(DeprecationWarning):
9696
idxr[nd3]
9797

9898
def test_setitem_ndarray_3d(self, index, frame_or_series, indexer_sli):

pandas/tests/io/test_compression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def test_compression_warning(compression_only):
112112
)
113113
with tm.ensure_clean() as path:
114114
with icom.get_handle(path, "w", compression=compression_only) as handles:
115-
with tm.assert_produces_warning(RuntimeWarning, check_stacklevel=False):
115+
with tm.assert_produces_warning(RuntimeWarning):
116116
df.to_csv(handles.handle, compression=compression_only)
117117

118118

0 commit comments

Comments
 (0)