Skip to content

Commit 8dec216

Browse files
anmyachevvnlitvinov
authored andcommitted
added message for pytest.skip(); more complete docstring in _parse_delimited_date now
1 parent 8ccbedd commit 8dec216

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

pandas/_libs/tslibs/parsing.pyx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,16 @@ cdef inline int _parse_4digit(const char* s):
7676

7777
cdef inline object _parse_delimited_date(object date_string, bint dayfirst):
7878
"""
79-
Parse special cases of dates: MM/DD/YYYY, DD/MM/YYYY, MM/YYYY
79+
Parse special cases of dates: MM/DD/YYYY, DD/MM/YYYY, MM/YYYY.
80+
At the beginning function tries to parse date in MM/DD/YYYY format, but
81+
if month > 12 - in DD/MM/YYYY (`dayfirst == False`).
82+
With `dayfirst == True` function makes an attempt to parse date in
83+
DD/MM/YYYY, if an attemp is wrong - in DD/MM/YYYY
8084
8185
Note
8286
----
83-
For MM/DD/YYYY, DD/MM/YYYY: delimiter can be a space or one of ./\-
84-
For MM/YYYY: delimiter can be a space or one of /\-
87+
For MM/DD/YYYY, DD/MM/YYYY: delimiter can be a space or one of ./-\\
88+
For MM/YYYY: delimiter can be a space or one of /-\\
8589
If `date_string` can't be converted to date, then function returns
8690
None, None
8791

pandas/tests/io/parser/test_parse_dates.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
# constant
3333
_DEFAULT_DATETIME = datetime(1, 1, 1)
34+
3435
# Strategy for hypothesis
3536
gen_random_datetime = st.dates(
3637
min_value=date(1900, 1, 1), # on Windows for %y need: year > 1900
@@ -921,9 +922,8 @@ def _helper_hypothesis_delimited_date(call, date_string, **kwargs):
921922
])
922923
def test_hypothesis_delimited_date(date_format, dayfirst, delimiter, date):
923924
if date_format == "%m %Y" and delimiter == ".":
924-
# parse_datetime_string cannot reliably tell whether e.g. %m.%Y
925-
# is a float or a date, thus we skip it
926-
pytest.skip()
925+
pytest.skip("parse_datetime_string cannot reliably tell whether \
926+
e.g. %m.%Y is a float or a date, thus we skip it")
927927
result, expected = None, None
928928
except_in_dateutil, except_out_dateutil = None, None
929929
date_string = date.strftime(date_format.replace(' ', delimiter))

0 commit comments

Comments
 (0)