You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
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.
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.
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.
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? ;)
On Thu, Mar 8, 2018 at 9:39 PM, jakirkham ***@***.***> wrote:
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? ;)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2694 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AASszNS71k_-0CR8xBCb5S9vEF1vVrDQks5tcet0gaJpZM4PfdCT>
.
Activity
sinhrks commentedon Sep 26, 2017
Maybe we can define common
assert_eqwhich dispatches to array/dataframeassert_eqeach.jakirkham commentedon Sep 27, 2017
That's not a bad idea. I realize I left this issue kind of vague as there are lots of
assert_eqimplementations and wasn't sure how we might want to deal with this variety. Having a dispatching function makes a lot of sense.jakirkham commentedon Dec 1, 2017
Another way to address this for Dask Array at least would be to create an equivalent
dask.array.testingtonumpy.testingand add those function here via refactoring the existing code.pitrou commentedon Dec 1, 2017
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.
TomAugspurger commentedon Dec 6, 2017
FWIW, xarray may make use of
dask.array.utils.assert_eq: pydata/xarray#1759 (comment)jakirkham commentedon Dec 6, 2017
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.
mrocklin commentedon Dec 6, 2017
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.
jakirkham commentedon Mar 9, 2018
Not attached to the NumPy approach. Just trying to sell the idea of making these functions public. ;)
FWIW I already use
assert_eqdownstream. Wonder if there are others. :)The main thing is the
assert_eqfunctions actually do a lot of checks that are really smart that external users might not thing to check (e.g.nanin 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? ;)
mrocklin commentedon Mar 9, 2018
jakirkham commentedon Jul 22, 2018
Addressed in PR ( #3726 ).