Skip to content

Commit b8d2f46

Browse files
Backport PR pandas-dev#49070 on branch 1.5.x (CI: Fix DeprecationWarning of numpy dev) (pandas-dev#49074)
Backport PR pandas-dev#49070: CI: Fix DeprecationWarning of numpy dev Co-authored-by: Patrick Hoefler <[email protected]>
1 parent 212c651 commit b8d2f46

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pandas/tests/series/test_constructors.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
iNaT,
1414
lib,
1515
)
16+
from pandas.compat import is_numpy_dev
1617
import pandas.util._test_decorators as td
1718

1819
from pandas.core.dtypes.common import (
@@ -734,13 +735,18 @@ def test_constructor_cast(self):
734735
def test_constructor_signed_int_overflow_deprecation(self):
735736
# GH#41734 disallow silent overflow
736737
msg = "Values are too large to be losslessly cast"
737-
with tm.assert_produces_warning(FutureWarning, match=msg):
738+
numpy_warning = DeprecationWarning if is_numpy_dev else None
739+
with tm.assert_produces_warning(
740+
(FutureWarning, numpy_warning), match=msg, check_stacklevel=False
741+
):
738742
ser = Series([1, 200, 923442], dtype="int8")
739743

740744
expected = Series([1, -56, 50], dtype="int8")
741745
tm.assert_series_equal(ser, expected)
742746

743-
with tm.assert_produces_warning(FutureWarning, match=msg):
747+
with tm.assert_produces_warning(
748+
(FutureWarning, numpy_warning), match=msg, check_stacklevel=False
749+
):
744750
ser = Series([1, 200, 923442], dtype="uint8")
745751

746752
expected = Series([1, 200, 50], dtype="uint8")

0 commit comments

Comments
 (0)