Skip to content

Commit cb547d6

Browse files
Jason MokJason Mok
authored andcommitted
TST: load a datetime saved as feather
1 parent 236d89b commit cb547d6

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

pandas/tests/io/test_feather.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""test feather-format compat"""
22

33
import zoneinfo
4+
from datetime import datetime
45

56
import numpy as np
67
import pytest
@@ -11,7 +12,6 @@
1112
ArrowStringArray,
1213
StringArray,
1314
)
14-
1515
from pandas.io.feather_format import read_feather, to_feather # isort:skip
1616

1717
pytestmark = pytest.mark.filterwarnings(
@@ -247,3 +247,18 @@ def test_string_inference(self, tmp_path):
247247
result = read_feather(path)
248248
expected = pd.DataFrame(data={"a": ["x", "y"]}, dtype="string[pyarrow_numpy]")
249249
tm.assert_frame_equal(result, expected)
250+
251+
def test_out_of_bounds_datetime_to_feather(self):
252+
# GH#47832
253+
df = pd.DataFrame({
254+
"date": [
255+
datetime.fromisoformat("1654-01-01"),
256+
datetime.fromisoformat("1920-01-01"),
257+
]
258+
})
259+
260+
feather_path = "tmp.feather"
261+
df.to_feather(feather_path)
262+
expected = df.copy()
263+
result = pd.read_feather(feather_path)
264+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)