Skip to content

Commit 7cb24d3

Browse files
committed
TST: Add test case for integer precision inconsistency
1 parent 5d31e3b commit 7cb24d3

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

pandas/tests/series/test_constructors.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2157,6 +2157,36 @@ def test_inference_on_pandas_objects(self):
21572157
result = Series(idx)
21582158
assert result.dtype != np.object_
21592159

2160+
def test_series_constructor_maskedarray_int_overflow(self):
2161+
# GH#56566
2162+
mx = ma.masked_array(
2163+
[
2164+
4873214862074861312,
2165+
4875446630161458944,
2166+
4824652147895424384,
2167+
0,
2168+
3526420114272476800,
2169+
],
2170+
mask=[0, 0, 0, 1, 0],
2171+
)
2172+
result = Series(mx, dtype="Int64")
2173+
expected = Series(
2174+
IntegerArray(
2175+
np.array(
2176+
[
2177+
4873214862074861312,
2178+
4875446630161458944,
2179+
4824652147895424384,
2180+
0,
2181+
3526420114272476800,
2182+
],
2183+
dtype="int64",
2184+
),
2185+
np.array([0, 0, 0, 1, 0], dtype=np.bool_),
2186+
)
2187+
)
2188+
tm.assert_series_equal(result, expected)
2189+
21602190

21612191
class TestSeriesConstructorIndexCoercion:
21622192
def test_series_constructor_datetimelike_index_coercion(self):

0 commit comments

Comments
 (0)