Skip to content

passing of test_to_datetime_with_non_exact depends on OS language. #10834

Closed
@cel4

Description

@cel4

The abbreviations of the names of months in format_regex are language specific. Thus the test fails on non-english systems:

format_regex on this machine is

re.compile('(?P<d>3[0-1]|[1-2]\\d|0[1-9]|[1-9]| [1-9])(?P<b>jan|feb|m\\är|apr|mai|jun|jul|aug|sep|okt|nov|dez)(?P<y>\\d\\d)', re.IGNORECASE)

ERROR: test_to_datetime_with_non_exact (pandas.tseries.tests.test_timeseries.TimeConversionFormats)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/ch/repo/pandas/.tox/py34/lib/python3.4/site-packages/pandas/tseries/tools.py", line 363, in _convert_listlike
    values, tz = tslib.datetime_to_datetime64(arg)
  File "tslib.pyx", line 1451, in pandas.tslib.datetime_to_datetime64 (pandas/tslib.c:22987)
TypeError: Unrecognized value type: <class 'str'>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ch/repo/pandas/.tox/py34/lib/python3.4/site-packages/pandas/tseries/tests/test_timeseries.py", line 4335, in test_to_datetime_with_non_exact
    result = to_datetime(s,format='%d%b%y',exact=False)
  File "/Users/ch/repo/pandas/.tox/py34/lib/python3.4/site-packages/pandas/util/decorators.py", line 89, in wrapper
    return func(*args, **kwargs)
  File "/Users/ch/repo/pandas/.tox/py34/lib/python3.4/site-packages/pandas/tseries/tools.py", line 267, in to_datetime
    unit=unit, infer_datetime_format=infer_datetime_format)
  File "/Users/ch/repo/pandas/.tox/py34/lib/python3.4/site-packages/pandas/tseries/tools.py", line 373, in _to_datetime
    values = _convert_listlike(arg.values, False, format)
  File "/Users/ch/repo/pandas/.tox/py34/lib/python3.4/site-packages/pandas/tseries/tools.py", line 366, in _convert_listlike
    raise e
  File "/Users/ch/repo/pandas/.tox/py34/lib/python3.4/site-packages/pandas/tseries/tools.py", line 336, in _convert_listlike
    arg, format, exact=exact, errors=errors)
  File "tslib.pyx", line 3018, in pandas.tslib.array_strptime (pandas/tslib.c:44557)
ValueError: time data '19MAY11' does not match format '%d%b%y' (search)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Testingpandas testing functions or related to the test suite

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions