-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
provide a error summary for assert_allclose #3847
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
9acb3b7
allow passing a callable as compat to diff_{dataset,array}_repr
keewis 660edd3
rewrite assert_allclose to provide a failure summary
keewis fd1ca50
make sure we're comparing variables
keewis 94f20e7
remove spurious comments
keewis 0d5d00f
override test_aggregate_complex with a test compatible with pint
keewis 983a545
expect the asserts to raise
keewis a724df7
xfail the tests failing due to isclose not accepting non-quantity tol…
keewis 1f305d0
Merge branch 'master' into assert_allclose-formatting
keewis ccd20fe
mark top-level function tests as xfailing if they use assert_allclose
keewis 29a6a1f
mark test_1d_math as runnable but xfail it
keewis 253ff92
Merge branch 'master' into assert_allclose-formatting
keewis 2c52f86
bump dask and distributed
keewis 1932a52
entry to whats-new.rst
keewis 7fef8b4
Merge branch 'master' into assert_allclose-formatting
keewis f3b9b13
attempt to fix the failing py36-min-all-deps and py36-min-nep18 CI
keewis 0220f45
Merge branch 'master' into assert_allclose-formatting
keewis 0286c02
conditionally xfail tests using assert_allclose with pint < 0.12
keewis f13bcb1
Merge branch 'master' into assert_allclose-formatting
keewis c5ce18d
xfail more tests depending on which pint version is used
keewis 93e60a7
Merge branch 'master' into assert_allclose-formatting
keewis 1d6bfe8
try using numpy.testing.assert_allclose instead
keewis 22f1fc3
try computing if the dask version is too old and dask.array[bool]
keewis 137a4ee
fix the dask version checking
keewis 1b26851
convert all dask arrays to numpy when using a insufficient dask version
keewis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,32 @@ | ||
import pytest | ||
|
||
import xarray as xr | ||
|
||
|
||
def test_allclose_regression(): | ||
x = xr.DataArray(1.01) | ||
y = xr.DataArray(1.02) | ||
xr.testing.assert_allclose(x, y, atol=0.01) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"obj1,obj2", | ||
( | ||
pytest.param( | ||
xr.Variable("x", [1e-17, 2]), xr.Variable("x", [0, 3]), id="Variable", | ||
), | ||
pytest.param( | ||
xr.DataArray([1e-17, 2], dims="x"), | ||
xr.DataArray([0, 3], dims="x"), | ||
id="DataArray", | ||
), | ||
pytest.param( | ||
xr.Dataset({"a": ("x", [1e-17, 2]), "b": ("y", [-2e-18, 2])}), | ||
xr.Dataset({"a": ("x", [0, 2]), "b": ("y", [0, 1])}), | ||
id="Dataset", | ||
), | ||
), | ||
) | ||
def test_assert_allclose(obj1, obj2): | ||
with pytest.raises(AssertionError): | ||
xr.testing.assert_allclose(obj1, obj2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like pint 0.12 is out. Shall we remove these xfails now or do you want to do that later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think something went wrong with the release of
0.12
so I'd like to wait until I got a response from the maintainerThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Sounds good. IMO we should merge this.