@@ -688,9 +688,10 @@ def test_to_datetime_dt64s(self, cache, dt):
688
688
"dt" , [np .datetime64 ("1000-01-01" ), np .datetime64 ("5000-01-02" )]
689
689
)
690
690
def test_to_datetime_dt64s_out_of_bounds (self , cache , dt ):
691
- msg = f "Out of bounds nanosecond timestamp: { dt } "
691
+ msg = "Out of bounds .* present at position 0 "
692
692
with pytest .raises (OutOfBoundsDatetime , match = msg ):
693
693
to_datetime (dt , errors = "raise" )
694
+ msg = f"Out of bounds nanosecond timestamp: { dt } "
694
695
with pytest .raises (OutOfBoundsDatetime , match = msg ):
695
696
Timestamp (dt )
696
697
assert to_datetime (dt , errors = "coerce" , cache = cache ) is NaT
@@ -973,13 +974,13 @@ def test_datetime_outofbounds_scalar(self, value, format, infer):
973
974
assert res is NaT
974
975
975
976
if format is not None :
976
- msg = "is a bad directive in format|Out of bounds nanosecond timestamp "
977
+ msg = "is a bad directive in format|Out of bounds .* present at position 0 "
977
978
with pytest .raises (ValueError , match = msg ):
978
979
to_datetime (
979
980
value , errors = "raise" , format = format , infer_datetime_format = infer
980
981
)
981
982
else :
982
- msg = "Out of bounds nanosecond timestamp "
983
+ msg = "Out of bounds .* present at position 0 "
983
984
with pytest .raises (OutOfBoundsDatetime , match = msg ):
984
985
to_datetime (
985
986
value , errors = "raise" , format = format , infer_datetime_format = infer
@@ -1700,7 +1701,7 @@ def test_to_datetime_barely_out_of_bounds(self):
1700
1701
# in an in-bounds datetime
1701
1702
arr = np .array (["2262-04-11 23:47:16.854775808" ], dtype = object )
1702
1703
1703
- msg = "Out of bounds nanosecond timestamp "
1704
+ msg = "Out of bounds .* present at position 0 "
1704
1705
with pytest .raises (OutOfBoundsDatetime , match = msg ):
1705
1706
to_datetime (arr )
1706
1707
@@ -2593,7 +2594,10 @@ def test_invalid_origins_tzinfo(self):
2593
2594
@pytest .mark .parametrize ("format" , [None , "%Y-%m-%d %H:%M:%S" ])
2594
2595
def test_to_datetime_out_of_bounds_with_format_arg (self , format ):
2595
2596
# see gh-23830
2596
- msg = "Out of bounds nanosecond timestamp"
2597
+ msg = (
2598
+ "Out of bounds nanosecond timestamp: 2417-10-27 00:00:00 "
2599
+ "present at position 0"
2600
+ )
2597
2601
with pytest .raises (OutOfBoundsDatetime , match = msg ):
2598
2602
to_datetime ("2417-10-27 00:00:00" , format = format )
2599
2603
0 commit comments