@@ -1093,7 +1093,7 @@ def test_datetime_bool_arrays_mixed(self, cache):
1093
1093
to_datetime ([False , datetime .today ()], cache = cache )
1094
1094
with pytest .raises (
1095
1095
ValueError ,
1096
- match = r"^time data 'True' does not match format '%Y%m%d' \(match\)$" ,
1096
+ match = r"^time data 'True' does not match format '%Y%m%d' \(match\) at position 1 $" ,
1097
1097
):
1098
1098
to_datetime (["20130101" , True ], cache = cache )
1099
1099
tm .assert_index_equal (
@@ -2072,7 +2072,9 @@ def test_to_datetime_on_datetime64_series(self, cache):
2072
2072
def test_to_datetime_with_space_in_series (self , cache ):
2073
2073
# GH 6428
2074
2074
ser = Series (["10/18/2006" , "10/18/2008" , " " ])
2075
- msg = r"^time data ' ' does not match format '%m/%d/%Y' \(match\)$"
2075
+ msg = (
2076
+ r"^time data ' ' does not match format '%m/%d/%Y' \(match\) at position 2$"
2077
+ )
2076
2078
with pytest .raises (ValueError , match = msg ):
2077
2079
to_datetime (ser , errors = "raise" , cache = cache )
2078
2080
result_coerce = to_datetime (ser , errors = "coerce" , cache = cache )
@@ -2342,7 +2344,7 @@ def test_dayfirst_warnings_invalid_input(self):
2342
2344
2343
2345
with pytest .raises (
2344
2346
ValueError ,
2345
- match = r"time data '03/30/2011' does not match format '%d/%m/%Y' \(match\)$" ,
2347
+ match = r"time data '03/30/2011' does not match format '%d/%m/%Y' \(match\) at position 1 $" ,
2346
2348
):
2347
2349
to_datetime (arr , dayfirst = True )
2348
2350
@@ -2923,17 +2925,22 @@ def test_incorrect_value_exception(self):
2923
2925
to_datetime (["today" , "yesterday" ])
2924
2926
2925
2927
@pytest .mark .parametrize (
2926
- "format, warning" , [(None , UserWarning ), ("%Y-%m-%d %H:%M:%S" , None )]
2928
+ "format, warning" ,
2929
+ [
2930
+ (None , UserWarning ),
2931
+ ("%Y-%m-%d %H:%M:%S" , None ),
2932
+ ("%Y-%d-%m %H:%M:%S" , None ),
2933
+ ],
2927
2934
)
2928
2935
def test_to_datetime_out_of_bounds_with_format_arg (self , format , warning ):
2929
2936
# see gh-23830
2930
2937
msg = (
2931
- "Out of bounds nanosecond timestamp: 2417-10-27 00:00:00 "
2932
- "present at position 0"
2938
+ r "Out of bounds nanosecond timestamp: 2417-10-10 00:00:00"
2939
+ r".* at position 0"
2933
2940
)
2934
2941
with pytest .raises (OutOfBoundsDatetime , match = msg ):
2935
2942
with tm .assert_produces_warning (warning , match = "Could not infer format" ):
2936
- to_datetime ("2417-10-27 00:00:00" , format = format )
2943
+ to_datetime ("2417-10-10 00:00:00" , format = format )
2937
2944
2938
2945
@pytest .mark .parametrize (
2939
2946
"arg, origin, expected_str" ,
0 commit comments