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 xarray's test suite with the dask master #3235

Merged
merged 1 commit into from
Aug 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions xarray/tests/test_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ def test_repr(self):
expected = dedent(
"""\
<xarray.Variable (x: 4, y: 6)>
dask.array<array, shape=(4, 6), dtype=float64, chunksize=(2, 2)>"""
{!r}""".format(
self.lazy_var.data
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these get any more complex, I've had great results using https://gitlab.com/uweschmitt/pytest-regtest - a snapshot / expect test framework - for string outputs that require checking but not explicitly constructing.

)
assert expected == repr(self.lazy_var)

Expand Down Expand Up @@ -499,10 +501,12 @@ def test_dataarray_repr_legacy(self):
expected = dedent(
"""\
<xarray.DataArray 'data' (x: 1)>
dask.array<data, shape=(1,), dtype=int64, chunksize=(1,)>
{!r}
Coordinates:
y (x) int64 dask.array<chunksize=(1,)>
Dimensions without coordinates: x"""
Dimensions without coordinates: x""".format(
data
)
)
assert expected == repr(a)
assert kernel_call_count == 0 # should not evaluate dask array
Expand All @@ -515,10 +519,12 @@ def test_dataarray_repr(self):
expected = dedent(
"""\
<xarray.DataArray 'data' (x: 1)>
dask.array<data, shape=(1,), dtype=int64, chunksize=(1,)>
{!r}
Coordinates:
y (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
Dimensions without coordinates: x"""
Dimensions without coordinates: x""".format(
data
)
)
assert expected == repr(a)
assert kernel_call_count == 0 # should not evaluate dask array
Expand Down