Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test_slicing_errors failing for older NumPy versions #71

Merged
merged 1 commit into from
Jan 10, 2018

Conversation

nils-werner
Copy link
Contributor

Prior to NumPy 1.13.0, you would see a VisibleDeprecationWarning but no exception when using illegal indexing values. This makes test test_slicing_errors[index6] fail.

__________________________________ test_slicing_errors[index6] ____________________________________

index = [True, False, False]

    @pytest.mark.parametrize('index', [
        (Ellipsis, Ellipsis),
        (1, 1, 1, 1),
        (slice(None),) * 4,
        5,
        -5,
        'foo',
        ([True, False, False]),
    ])
    def test_slicing_errors(index):
        s = sparse.random((2, 3, 4), density=0.5)
        x = s.todense()

        try:
            x[index]
        except Exception as e:
            e1 = e
        else:
>           raise Exception("exception not raised")
E           Exception: exception not raised

sparse/tests/test_core.py:473: Exception
===================================== warnings summary ==============================================
sparse/tests/test_core.py::test_slicing_errors[index6]
  /Users/nwerner/Arbeit/mdct/sparse/sparse/tests/test_core.py:469: VisibleDeprecationWarning: boolean
  index did not match indexed array along dimension 0; dimension is 2 but corresponding boolean dimension is 3
    x[index]

-- Docs: http://doc.pytest.org/en/latest/warnings.html

Either the test should be skipped for NumPy < 1.13.0, or we should bump the dependency version.

@mrocklin
Copy link
Contributor

I'm in favor of skipping or xfailing the test rather than require this numpy version.

@nils-werner
Copy link
Contributor Author

Makes sense, I replaced the requirement with a pytest.mark.skipif decorator.

@nils-werner nils-werner changed the title Bump numpy version Fix test_slicing_errors failing for older NumPy versions Jan 10, 2018
@hameerabbasi
Copy link
Collaborator

I agree with @mrocklin here. Since we're emulating the latest Numpy, but not really using anything from it, it makes sense to skip the test rather than bump the version.

@nils-werner
Copy link
Contributor Author

This should be ready to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants