|
13 | 13 | iNaT,
|
14 | 14 | lib,
|
15 | 15 | )
|
| 16 | +from pandas.compat import is_numpy_dev |
16 | 17 | import pandas.util._test_decorators as td
|
17 | 18 |
|
18 | 19 | from pandas.core.dtypes.common import (
|
@@ -734,13 +735,18 @@ def test_constructor_cast(self):
|
734 | 735 | def test_constructor_signed_int_overflow_deprecation(self):
|
735 | 736 | # GH#41734 disallow silent overflow
|
736 | 737 | 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 | + ): |
738 | 742 | ser = Series([1, 200, 923442], dtype="int8")
|
739 | 743 |
|
740 | 744 | expected = Series([1, -56, 50], dtype="int8")
|
741 | 745 | tm.assert_series_equal(ser, expected)
|
742 | 746 |
|
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 | + ): |
744 | 750 | ser = Series([1, 200, 923442], dtype="uint8")
|
745 | 751 |
|
746 | 752 | expected = Series([1, 200, 50], dtype="uint8")
|
|
0 commit comments