@@ -232,10 +232,7 @@ def test_parsers_month_freq(date_str, expected):
232232 ],
233233)
234234def test_guess_datetime_format_with_parseable_formats (string , fmt ):
235- with tm .maybe_produces_warning (
236- UserWarning , fmt is not None and re .search (r"%d.*%m" , fmt )
237- ):
238- result = parsing .guess_datetime_format (string )
235+ result = parsing .guess_datetime_format (string )
239236 assert result == fmt
240237
241238
@@ -292,31 +289,25 @@ def test_guess_datetime_format_wrong_type_inputs(invalid_type_dt):
292289
293290
294291@pytest .mark .parametrize (
295- "string,fmt,dayfirst,warning " ,
292+ "string,fmt,dayfirst" ,
296293 [
297- ("2011-1-1" , "%Y-%m-%d" , False , None ),
298- ("2011-1-1" , "%Y-%d-%m" , True , None ),
299- ("1/1/2011" , "%m/%d/%Y" , False , None ),
300- ("1/1/2011" , "%d/%m/%Y" , True , None ),
301- ("30-1-2011" , "%d-%m-%Y" , False , UserWarning ),
302- ("30-1-2011" , "%d-%m-%Y" , True , None ),
303- ("2011-1-1 0:0:0" , "%Y-%m-%d %H:%M:%S" , False , None ),
304- ("2011-1-1 0:0:0" , "%Y-%d-%m %H:%M:%S" , True , None ),
305- ("2011-1-3T00:00:0" , "%Y-%m-%dT%H:%M:%S" , False , None ),
306- ("2011-1-3T00:00:0" , "%Y-%d-%mT%H:%M:%S" , True , None ),
307- ("2011-1-1 00:00:00" , "%Y-%m-%d %H:%M:%S" , False , None ),
308- ("2011-1-1 00:00:00" , "%Y-%d-%m %H:%M:%S" , True , None ),
294+ ("2011-1-1" , "%Y-%m-%d" , False ),
295+ ("2011-1-1" , "%Y-%d-%m" , True ),
296+ ("1/1/2011" , "%m/%d/%Y" , False ),
297+ ("1/1/2011" , "%d/%m/%Y" , True ),
298+ ("30-1-2011" , "%d-%m-%Y" , False ),
299+ ("30-1-2011" , "%d-%m-%Y" , True ),
300+ ("2011-1-1 0:0:0" , "%Y-%m-%d %H:%M:%S" , False ),
301+ ("2011-1-1 0:0:0" , "%Y-%d-%m %H:%M:%S" , True ),
302+ ("2011-1-3T00:00:0" , "%Y-%m-%dT%H:%M:%S" , False ),
303+ ("2011-1-3T00:00:0" , "%Y-%d-%mT%H:%M:%S" , True ),
304+ ("2011-1-1 00:00:00" , "%Y-%m-%d %H:%M:%S" , False ),
305+ ("2011-1-1 00:00:00" , "%Y-%d-%m %H:%M:%S" , True ),
309306 ],
310307)
311- def test_guess_datetime_format_no_padding (string , fmt , dayfirst , warning ):
308+ def test_guess_datetime_format_no_padding (string , fmt , dayfirst ):
312309 # see gh-11142
313- msg = (
314- rf"Parsing dates in { fmt } format when dayfirst=False \(the default\) "
315- "was specified. "
316- "Pass `dayfirst=True` or specify a format to silence this warning."
317- )
318- with tm .assert_produces_warning (warning , match = msg ):
319- result = parsing .guess_datetime_format (string , dayfirst = dayfirst )
310+ result = parsing .guess_datetime_format (string , dayfirst = dayfirst )
320311 assert result == fmt
321312
322313
0 commit comments