From 97f6f759e061905989e591349c734be6446e95e4 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Wed, 11 Jan 2023 16:02:09 -0800 Subject: [PATCH 1/3] TST: Fix test_constructor_signed_int_overflow_deprecation multiple warnings --- pandas/tests/series/test_constructors.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pandas/tests/series/test_constructors.py b/pandas/tests/series/test_constructors.py index e4ab5ef596440..69db33d9524dc 100644 --- a/pandas/tests/series/test_constructors.py +++ b/pandas/tests/series/test_constructors.py @@ -740,18 +740,18 @@ def test_constructor_cast(self): def test_constructor_signed_int_overflow_deprecation(self): # GH#41734 disallow silent overflow msg = "Values are too large to be losslessly cast" - numpy_warning = DeprecationWarning if is_numpy_dev else None - with tm.assert_produces_warning( - (FutureWarning, numpy_warning), match=msg, check_stacklevel=False - ): + warns = ( + (FutureWarning, DeprecationWarning) + if is_numpy_dev or np_version_gte1p24 + else FutureWarning + ) + with tm.assert_produces_warning(warns, match=msg, check_stacklevel=False): ser = Series([1, 200, 923442], dtype="int8") expected = Series([1, -56, 50], dtype="int8") tm.assert_series_equal(ser, expected) - with tm.assert_produces_warning( - (FutureWarning, numpy_warning), match=msg, check_stacklevel=False - ): + with tm.assert_produces_warning(warns, match=msg, check_stacklevel=False): ser = Series([1, 200, 923442], dtype="uint8") expected = Series([1, 200, 50], dtype="uint8") From 3875fb4133881a57409d27a0ad61b14029dd2582 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Wed, 11 Jan 2023 17:02:03 -0800 Subject: [PATCH 2/3] Works on 32 bit build --- pandas/tests/series/test_constructors.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pandas/tests/series/test_constructors.py b/pandas/tests/series/test_constructors.py index 69db33d9524dc..551883c61750c 100644 --- a/pandas/tests/series/test_constructors.py +++ b/pandas/tests/series/test_constructors.py @@ -13,10 +13,7 @@ iNaT, lib, ) -from pandas.compat import ( - IS64, - is_numpy_dev, -) +from pandas.compat import is_numpy_dev from pandas.compat.numpy import np_version_gte1p24 import pandas.util._test_decorators as td @@ -736,7 +733,7 @@ def test_constructor_cast(self): with pytest.raises(ValueError, match=msg): Series(["a", "b", "c"], dtype=float) - @pytest.mark.xfail(np_version_gte1p24 and not IS64, reason="GH49777") + @pytest.mark.xfail(np_version_gte1p24, reason="GH49777") def test_constructor_signed_int_overflow_deprecation(self): # GH#41734 disallow silent overflow msg = "Values are too large to be losslessly cast" From acd010109aeb4e9aa1546406dd34ae714473b2be Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Thu, 12 Jan 2023 10:01:20 -0800 Subject: [PATCH 3/3] Remove xfail --- pandas/tests/series/test_constructors.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas/tests/series/test_constructors.py b/pandas/tests/series/test_constructors.py index 551883c61750c..bc26158f40416 100644 --- a/pandas/tests/series/test_constructors.py +++ b/pandas/tests/series/test_constructors.py @@ -733,7 +733,6 @@ def test_constructor_cast(self): with pytest.raises(ValueError, match=msg): Series(["a", "b", "c"], dtype=float) - @pytest.mark.xfail(np_version_gte1p24, reason="GH49777") def test_constructor_signed_int_overflow_deprecation(self): # GH#41734 disallow silent overflow msg = "Values are too large to be losslessly cast"