Skip to content

Commit 1ffb79c

Browse files
authored
TST: Fix test_constructor_signed_int_overflow_deprecation w/ multiple warnings (#50686)
* TST: Fix test_constructor_signed_int_overflow_deprecation multiple warnings * Works on 32 bit build * Remove xfail
1 parent b69a5ce commit 1ffb79c

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

pandas/tests/series/test_constructors.py

+8-12
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
iNaT,
1414
lib,
1515
)
16-
from pandas.compat import (
17-
IS64,
18-
is_numpy_dev,
19-
)
16+
from pandas.compat import is_numpy_dev
2017
from pandas.compat.numpy import np_version_gte1p24
2118
import pandas.util._test_decorators as td
2219

@@ -736,22 +733,21 @@ def test_constructor_cast(self):
736733
with pytest.raises(ValueError, match=msg):
737734
Series(["a", "b", "c"], dtype=float)
738735

739-
@pytest.mark.xfail(np_version_gte1p24 and not IS64, reason="GH49777")
740736
def test_constructor_signed_int_overflow_deprecation(self):
741737
# GH#41734 disallow silent overflow
742738
msg = "Values are too large to be losslessly cast"
743-
numpy_warning = DeprecationWarning if is_numpy_dev else None
744-
with tm.assert_produces_warning(
745-
(FutureWarning, numpy_warning), match=msg, check_stacklevel=False
746-
):
739+
warns = (
740+
(FutureWarning, DeprecationWarning)
741+
if is_numpy_dev or np_version_gte1p24
742+
else FutureWarning
743+
)
744+
with tm.assert_produces_warning(warns, match=msg, check_stacklevel=False):
747745
ser = Series([1, 200, 923442], dtype="int8")
748746

749747
expected = Series([1, -56, 50], dtype="int8")
750748
tm.assert_series_equal(ser, expected)
751749

752-
with tm.assert_produces_warning(
753-
(FutureWarning, numpy_warning), match=msg, check_stacklevel=False
754-
):
750+
with tm.assert_produces_warning(warns, match=msg, check_stacklevel=False):
755751
ser = Series([1, 200, 923442], dtype="uint8")
756752

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

0 commit comments

Comments
 (0)