blaze / datashape

Language defining a data description protocol
BSD 2-Clause "Simplified" License
183 stars 65 forks source link

Test failures with numpy 1.14.0 #232

Open FRidh opened 6 years ago

FRidh commented 6 years ago
________________________________ test_validate _________________________________

    def test_validate():
        assert validate(int, 1)
>       assert validate('int', 1)
E       AssertionError: assert False
E        +  where False = validate('int', 1)

datashape/tests/test_user.py:8: AssertionError
___________________________ test_nested_iteratables ____________________________

    def test_nested_iteratables():
>       assert validate('2 * 3 * int', [(1, 2, 3), (4, 5, 6)])
E       AssertionError: assert False
E        +  where False = validate('2 * 3 * int', [(1, 2, 3), (4, 5, 6)])

datashape/tests/test_user.py:19: AssertionError
_____________________________ test_validate_dicts ______________________________

    def test_validate_dicts():
>       assert validate('{x: int, y: int}', {'x': 1, 'y': 2})
E       AssertionError: assert False
E        +  where False = validate('{x: int, y: int}', {'x': 1, 'y': 2})

datashape/tests/test_user.py:26: AssertionError
________________________ test_tuples_can_be_records_too ________________________

    def test_tuples_can_be_records_too():
>       assert validate('{x: int, y: real}', (1, 2.0))
E       AssertionError: assert False
E        +  where False = validate('{x: int, y: real}', (1, 2.0))

datashape/tests/test_user.py:36: AssertionError
mingwandroid commented 6 years ago

Does anyone know anything about this failure?

kglowinski commented 6 years ago

It has to do with changes in numpy in 1.14.0+: https://github.com/numpy/numpy/blob/master/doc/release/1.14.0-notes.rst#future-changes

In particular:

np.issubdtype will stop downcasting dtype-like arguments. It might be expected that issubdtype(np.float32, 'float64') and issubdtype(np.float32, np.float64) mean the same thing - however, there was an undocumented special case that translated the former into issubdtype(np.float32, np.floating), giving the surprising result of True.

This means that all the validate tests are now just meaningless for what they were testing with 'int'.