Skip to content

Document and expose assert_eq in public API #2694

Closed

Description

@jakirkham

Would be great to have assert_eq documented and exposed as part of the public API. Should help answer questions about what it does internally as well as providing a preferred way to test results from Dask.

Activity

  1. sinhrks commented on Sep 26, 2017

    @sinhrks
    Member

    Maybe we can define common assert_eq which dispatches to array/dataframe assert_eq each.

  2. jakirkham commented on Sep 27, 2017

    @jakirkham
    MemberAuthor

    That's not a bad idea. I realize I left this issue kind of vague as there are lots of assert_eq implementations and wasn't sure how we might want to deal with this variety. Having a dispatching function makes a lot of sense.

  3. jakirkham commented on Dec 1, 2017

    @jakirkham
    MemberAuthor

    Another way to address this for Dask Array at least would be to create an equivalent dask.array.testing to numpy.testing and add those function here via refactoring the existing code.

  4. pitrou commented on Dec 1, 2017

    @pitrou
    Member

    I'd be wary of exposing such a function in the public API. We want to be able to change its behaviour over time without having people complain that we broke their code.

    We can still document it, though, as long as it's made clear that it's for internal use. Also +1 for a dedicated place for testing-related utilities.

  5. TomAugspurger commented on Dec 6, 2017

    @TomAugspurger
    Member

    FWIW, xarray may make use of dask.array.utils.assert_eq: pydata/xarray#1759 (comment)

  6. jakirkham commented on Dec 6, 2017

    @jakirkham
    MemberAuthor

    Sure. Have used it myself as well (hence the issue 😉). Though it certainly isn't documented as part of the public API FWICT. So in theory we can't really expect it to always work or stay the same. In practice, we might have to be more careful about changing it given there is external use (guessing this is your point).

    That said, maybe it will be better to add some new assertion functions that mimic NumPy's own and state they are part of the public API to begin with. Then external libraries can switch to them and we can even consider doing the same internally.

  7. mrocklin commented on Dec 6, 2017

    @mrocklin
    Member

    FWIW I find the numpy assert functions to be somewhat cumbersome. I think that for testing I tend to prefer the all-in-one magical function approach.

    I also think that because this is primarily used in testing that we have some more flexibility about changing assert_eq without much notice (though downstream libraries may differ). We also haven't changed it much recenty in ways that downstream libraries are likely to notice.

  8. jakirkham commented on Mar 9, 2018

    @jakirkham
    MemberAuthor

    Not attached to the NumPy approach. Just trying to sell the idea of making these functions public. ;)

    FWIW I already use assert_eq downstream. Wonder if there are others. :)

    The main thing is the assert_eq functions actually do a lot of checks that are really smart that external users might not thing to check (e.g. nan in shape or comparing results before and after computation). As a result, if downstream users do this all correctly, they have duplicated a lot of work we already did. Would be better to just share the answer. :)

    Given we haven't changed too much lately, seems like the perfect time to make them public, right? ;)

  9. mrocklin commented on Mar 9, 2018

    @mrocklin
    Member
  10. jakirkham commented on Jul 22, 2018

    @jakirkham
    MemberAuthor

    Addressed in PR ( #3726 ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions