Skip to content

Commit 451233b

Browse files
authored
MAINT: Catch expected warnings (#102)
Catch expected warnings to reduce noise in testing
1 parent 60fa48f commit 451233b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

tests/test_series.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ def test_types_max() -> None:
268268
s = pd.Series([1, 2, 3, np.nan])
269269
s.max()
270270
s.max(axis=0)
271-
s.max(level=0)
271+
with pytest.warns(FutureWarning, match="Using the level keyword"):
272+
s.max(level=0)
272273
s.max(skipna=False)
273274

274275

@@ -411,7 +412,8 @@ def test_types_plot() -> None:
411412
def test_types_window() -> None:
412413
s = pd.Series([0, 1, 1, 0, 5, 1, -10])
413414
s.expanding()
414-
s.expanding(axis=0, center=True)
415+
with pytest.warns(FutureWarning, match="The `center` argument"):
416+
s.expanding(axis=0, center=True)
415417

416418
s.rolling(2)
417419
s.rolling(2, axis=0, center=True)

tests/test_testing.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
assert_frame_equal,
44
assert_series_equal,
55
)
6+
import pytest
67

78

89
def test_types_assert_series_equal() -> None:
@@ -17,9 +18,10 @@ def test_types_assert_series_equal() -> None:
1718
check_flags=True,
1819
check_datetimelike_compat=True,
1920
)
20-
assert_series_equal(
21-
s1, s2, check_dtype=True, check_less_precise=True, check_names=True
22-
)
21+
with pytest.warns(FutureWarning, match="The 'check_less_precise'"):
22+
assert_series_equal(
23+
s1, s2, check_dtype=True, check_less_precise=True, check_names=True
24+
)
2325

2426

2527
def test_assert_frame_equal():

0 commit comments

Comments
 (0)