|
6 | 6 | import re |
7 | 7 |
|
8 | 8 | from dateutil.parser import parse as du_parse |
9 | | -from hypothesis import given |
10 | 9 | import numpy as np |
11 | 10 | import pytest |
12 | 11 |
|
|
30 | 29 | option_context, |
31 | 30 | ) |
32 | 31 | import pandas._testing as tm |
33 | | -from pandas._testing._hypothesis import DATETIME_NO_TZ |
34 | 32 |
|
35 | 33 |
|
36 | 34 | @pytest.mark.skipif(WASM, reason="tzset is not available on WASM") |
@@ -391,42 +389,6 @@ def _helper_hypothesis_delimited_date(call, date_string, **kwargs): |
391 | 389 | return msg, result |
392 | 390 |
|
393 | 391 |
|
394 | | -@pytest.mark.slow |
395 | | -@given(DATETIME_NO_TZ) |
396 | | -@pytest.mark.parametrize("delimiter", list(" -./")) |
397 | | -@pytest.mark.parametrize("dayfirst", [True, False]) |
398 | | -@pytest.mark.parametrize( |
399 | | - "date_format", |
400 | | - ["%d %m %Y", "%m %d %Y", "%m %Y", "%Y %m %d", "%y %m %d", "%Y%m%d", "%y%m%d"], |
401 | | -) |
402 | | -def test_hypothesis_delimited_date( |
403 | | - request, date_format, dayfirst, delimiter, test_datetime |
404 | | -): |
405 | | - if date_format == "%m %Y" and delimiter == ".": |
406 | | - request.applymarker( |
407 | | - pytest.mark.xfail( |
408 | | - reason="parse_datetime_string cannot reliably tell whether " |
409 | | - "e.g. %m.%Y is a float or a date", |
410 | | - strict=False, |
411 | | - ) |
412 | | - ) |
413 | | - date_string = test_datetime.strftime(date_format.replace(" ", delimiter)) |
414 | | - |
415 | | - except_out_dateutil, result = _helper_hypothesis_delimited_date( |
416 | | - parsing.py_parse_datetime_string, date_string, dayfirst=dayfirst |
417 | | - ) |
418 | | - except_in_dateutil, expected = _helper_hypothesis_delimited_date( |
419 | | - du_parse, |
420 | | - date_string, |
421 | | - default=datetime(1, 1, 1), |
422 | | - dayfirst=dayfirst, |
423 | | - yearfirst=False, |
424 | | - ) |
425 | | - |
426 | | - assert except_out_dateutil == except_in_dateutil |
427 | | - assert result == expected |
428 | | - |
429 | | - |
430 | 392 | @pytest.mark.parametrize("input", ["21-01-01", "01-01-21"]) |
431 | 393 | @pytest.mark.parametrize("dayfirst", [True, False]) |
432 | 394 | def test_parse_datetime_string_with_reso_dayfirst(dayfirst, input): |
|
0 commit comments