From 909c6da4d3627f95b02d6cc3f482cefbf166e24f Mon Sep 17 00:00:00 2001 From: Jason Mok <106209849+jasonmokk@users.noreply.github.com> Date: Thu, 7 Nov 2024 01:57:32 -0600 Subject: [PATCH] TST: Add test for `feather` I/O with historical out-of-bounds `datetime` values (#60209) Co-authored-by: Jason Mok Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> --- pandas/tests/io/test_feather.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pandas/tests/io/test_feather.py b/pandas/tests/io/test_feather.py index 9721d045b7b91..8ae2033faab4f 100644 --- a/pandas/tests/io/test_feather.py +++ b/pandas/tests/io/test_feather.py @@ -1,5 +1,6 @@ """test feather-format compat""" +from datetime import datetime import zoneinfo import numpy as np @@ -247,3 +248,15 @@ def test_string_inference(self, tmp_path): data={"a": ["x", "y"]}, dtype=pd.StringDtype(na_value=np.nan) ) tm.assert_frame_equal(result, expected) + + def test_out_of_bounds_datetime_to_feather(self): + # GH#47832 + df = pd.DataFrame( + { + "date": [ + datetime.fromisoformat("1654-01-01"), + datetime.fromisoformat("1920-01-01"), + ], + } + ) + self.check_round_trip(df)