@@ -1093,7 +1093,7 @@ def test_datetime_bool_arrays_mixed(self, cache):
10931093 to_datetime ([False , datetime .today ()], cache = cache )
10941094 with pytest .raises (
10951095 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 $" ,
10971097 ):
10981098 to_datetime (["20130101" , True ], cache = cache )
10991099 tm .assert_index_equal (
@@ -2072,7 +2072,9 @@ def test_to_datetime_on_datetime64_series(self, cache):
20722072 def test_to_datetime_with_space_in_series (self , cache ):
20732073 # GH 6428
20742074 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+ )
20762078 with pytest .raises (ValueError , match = msg ):
20772079 to_datetime (ser , errors = "raise" , cache = cache )
20782080 result_coerce = to_datetime (ser , errors = "coerce" , cache = cache )
@@ -2342,7 +2344,7 @@ def test_dayfirst_warnings_invalid_input(self):
23422344
23432345 with pytest .raises (
23442346 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 $" ,
23462348 ):
23472349 to_datetime (arr , dayfirst = True )
23482350
@@ -2923,17 +2925,22 @@ def test_incorrect_value_exception(self):
29232925 to_datetime (["today" , "yesterday" ])
29242926
29252927 @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+ ],
29272934 )
29282935 def test_to_datetime_out_of_bounds_with_format_arg (self , format , warning ):
29292936 # see gh-23830
29302937 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"
29332940 )
29342941 with pytest .raises (OutOfBoundsDatetime , match = msg ):
29352942 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 )
29372944
29382945 @pytest .mark .parametrize (
29392946 "arg, origin, expected_str" ,
0 commit comments