Skip to content

CI Failures for test_string_na_nat_conversion #26200

Closed
@WillAyd

Description

@WillAyd

These just started showing up in the build today:

___________ TestToDatetimeMisc.test_string_na_nat_conversion[False] ____________
[gw0] linux -- Python 3.7.3 /home/vsts/miniconda3/envs/pandas-dev/bin/python

self = <pandas.tests.indexes.datetimes.test_tools.TestToDatetimeMisc object at 0x7f38c92b73c8>
cache = False

    @pytest.mark.parametrize('cache', [True, False])
    def test_string_na_nat_conversion(self, cache):
        # GH #999, #858
    
        strings = np.array(['1/1/2000', '1/2/2000', np.nan,
                            '1/4/2000, 12:34:56'], dtype=object)
    
        expected = np.empty(4, dtype='M8[ns]')
        for i, val in enumerate(strings):
            if isna(val):
                expected[i] = iNaT
            else:
                expected[i] = parse(val)
    
        result = tslib.array_to_datetime(strings)[0]
        tm.assert_almost_equal(result, expected)
    
        result2 = to_datetime(strings, cache=cache)
        assert isinstance(result2, DatetimeIndex)
        tm.assert_numpy_array_equal(result, result2.values)
    
        malformed = np.array(['1/100/2000', np.nan], dtype=object)
    
        # GH 10636, default is now 'raise'
        msg = (r"\(u?'Unknown string format:', '1/100/2000'\)|"
               "day is out of range for month")
        with pytest.raises(ValueError, match=msg):
>           to_datetime(malformed, errors='raise', cache=cache)
E           AssertionError: Pattern '\(u?'Unknown string format:', '1/100/2000'\)|day is out of range for month' not found in 'Unknown string format: 1/100/2000'

Not sure what the root cause is. I figured should be good enough to relax the error message for the time being and not block CI for others.

@simonjayhawkins looks like you might have changed this test to add a more restrictive message so if you want to dive into further detail for a more comprehensive fix would certainly be welcome

Metadata

Metadata

Assignees

No one assigned

    Labels

    CIContinuous Integration

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions