Skip to content

Commit 7ab0d93

Browse files
committed
TST: Add test case for integer precision inconsistency
1 parent 7b9d9cf commit 7ab0d93

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

pandas/tests/series/test_constructors.py

+30
Original file line numberDiff line numberDiff line change
@@ -2164,6 +2164,36 @@ def test_inference_on_pandas_objects(self):
21642164
result = Series(idx)
21652165
assert result.dtype != np.object_
21662166

2167+
def test_series_constructor_maskedarray_int_overflow(self):
2168+
# GH#56566
2169+
mx = ma.masked_array(
2170+
[
2171+
4873214862074861312,
2172+
4875446630161458944,
2173+
4824652147895424384,
2174+
0,
2175+
3526420114272476800,
2176+
],
2177+
mask=[0, 0, 0, 1, 0],
2178+
)
2179+
result = Series(mx, dtype="Int64")
2180+
expected = Series(
2181+
IntegerArray(
2182+
np.array(
2183+
[
2184+
4873214862074861312,
2185+
4875446630161458944,
2186+
4824652147895424384,
2187+
0,
2188+
3526420114272476800,
2189+
],
2190+
dtype="int64",
2191+
),
2192+
np.array([0, 0, 0, 1, 0], dtype=np.bool_),
2193+
)
2194+
)
2195+
tm.assert_series_equal(result, expected)
2196+
21672197

21682198
class TestSeriesConstructorIndexCoercion:
21692199
def test_series_constructor_datetimelike_index_coercion(self):

0 commit comments

Comments
 (0)