@@ -688,7 +688,7 @@ 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'Cannot convert " { dt } " at position 0 to datetime'
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
694
msg = f"Out of bounds nanosecond timestamp: { dt } "
@@ -976,14 +976,14 @@ def test_datetime_outofbounds_scalar(self, value, format, infer):
976
976
if format is not None :
977
977
msg = (
978
978
"is a bad directive in format|"
979
- f'Cannot convert " { value } " at position 0 to datetime'
979
+ "Out of bounds .* present at position 0"
980
980
)
981
981
with pytest .raises (ValueError , match = msg ):
982
982
to_datetime (
983
983
value , errors = "raise" , format = format , infer_datetime_format = infer
984
984
)
985
985
else :
986
- msg = f'Cannot convert " { value } " at position 0 to datetime'
986
+ msg = "Out of bounds .* present at position 0"
987
987
with pytest .raises (OutOfBoundsDatetime , match = msg ):
988
988
to_datetime (
989
989
value , errors = "raise" , format = format , infer_datetime_format = infer
@@ -1704,7 +1704,7 @@ def test_to_datetime_barely_out_of_bounds(self):
1704
1704
# in an in-bounds datetime
1705
1705
arr = np .array (["2262-04-11 23:47:16.854775808" ], dtype = object )
1706
1706
1707
- msg = 'Cannot convert "2262-04-11 23:47:16.854775808" at position 0 to datetime'
1707
+ msg = "Out of bounds .* present at position 0"
1708
1708
with pytest .raises (OutOfBoundsDatetime , match = msg ):
1709
1709
to_datetime (arr )
1710
1710
@@ -2597,7 +2597,7 @@ def test_invalid_origins_tzinfo(self):
2597
2597
@pytest .mark .parametrize ("format" , [None , "%Y-%m-%d %H:%M:%S" ])
2598
2598
def test_to_datetime_out_of_bounds_with_format_arg (self , format ):
2599
2599
# see gh-23830
2600
- msg = 'Cannot convert " 2417-10-27 00:00:00" at position 0 to datetime'
2600
+ msg = "Out of bounds nanosecond timestamp: 2417-10-27 00:00:00 present at position 0"
2601
2601
with pytest .raises (OutOfBoundsDatetime , match = msg ):
2602
2602
to_datetime ("2417-10-27 00:00:00" , format = format )
2603
2603
0 commit comments