|
14 | 14 | iNaT, |
15 | 15 | lib, |
16 | 16 | ) |
| 17 | +from pandas.compat import is_numpy_dev |
17 | 18 | import pandas.util._test_decorators as td |
18 | 19 |
|
19 | 20 | from pandas.core.dtypes.common import ( |
@@ -735,13 +736,18 @@ def test_constructor_cast(self): |
735 | 736 | def test_constructor_signed_int_overflow_deprecation(self): |
736 | 737 | # GH#41734 disallow silent overflow |
737 | 738 | msg = "Values are too large to be losslessly cast" |
738 | | - with tm.assert_produces_warning(FutureWarning, match=msg): |
| 739 | + numpy_warning = DeprecationWarning if is_numpy_dev else None |
| 740 | + with tm.assert_produces_warning( |
| 741 | + (FutureWarning, numpy_warning), match=msg, check_stacklevel=False |
| 742 | + ): |
739 | 743 | ser = Series([1, 200, 923442], dtype="int8") |
740 | 744 |
|
741 | 745 | expected = Series([1, -56, 50], dtype="int8") |
742 | 746 | tm.assert_series_equal(ser, expected) |
743 | 747 |
|
744 | | - with tm.assert_produces_warning(FutureWarning, match=msg): |
| 748 | + with tm.assert_produces_warning( |
| 749 | + (FutureWarning, numpy_warning), match=msg, check_stacklevel=False |
| 750 | + ): |
745 | 751 | ser = Series([1, 200, 923442], dtype="uint8") |
746 | 752 |
|
747 | 753 | expected = Series([1, 200, 50], dtype="uint8") |
|
0 commit comments