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

Enable __setitem__ for dask versions that support it. #5174

Merged
merged 27 commits into from
May 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
14d18a7
Enable __setitem__ for dask versions that support it.
tammasloughran Apr 16, 2021
2e6b196
Cleanup
tammasloughran Apr 16, 2021
54aaa73
Dask is soft dependency
tammasloughran Apr 16, 2021
6ddb76c
Test for item assignment in dask
tammasloughran Apr 19, 2021
d75cd17
Fix minor mistakes
tammasloughran Apr 19, 2021
1bddcdd
raises_regex typo
tammasloughran Apr 19, 2021
0b5c7ad
Use assert_identical instead of assert
tammasloughran Apr 19, 2021
e725143
Update exception text
tammasloughran Apr 19, 2021
c84f774
tests/test_dask.py
tammasloughran Apr 19, 2021
f7d7bc4
Moved indexing tests to test_dask.py
tammasloughran Apr 19, 2021
63b4429
Code cleanup
tammasloughran Apr 19, 2021
b9768ce
More cleanup
tammasloughran Apr 19, 2021
777faaa
OuterIndexer not fully supported by dask. only use one array non-slic…
tammasloughran Apr 19, 2021
b4cb7d9
Cleanup again
tammasloughran Apr 19, 2021
b9a697e
Removed duplicate line
tammasloughran Apr 19, 2021
d141304
Conflict correction
tammasloughran Apr 20, 2021
8533072
Merge branch 'master' into master
tammasloughran Apr 20, 2021
3b1dbd3
Style corrections
tammasloughran Apr 20, 2021
bedfdf7
Merge branch 'master' of https://github.com/tammasloughran/xarray
tammasloughran Apr 20, 2021
c169fd0
pytest.raises not raises_regex
tammasloughran Apr 20, 2021
ee6efd0
Update xarray/core/indexing.py
tammasloughran Apr 21, 2021
9bc9b63
Update xarray/core/indexing.py
tammasloughran Apr 21, 2021
ee11d4e
New line
tammasloughran Apr 23, 2021
ca84825
mypy complains of type inconsistency for DASK_VERSION = None. Setting…
tammasloughran Apr 23, 2021
ae2a21f
Change ' to "
tammasloughran Apr 30, 2021
73bbadc
Added TODO and whats-new
tammasloughran May 1, 2021
153a7f3
Merge branch 'master' into master
tammasloughran May 1, 2021
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: 8 additions & 8 deletions xarray/tests/test_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,34 +114,34 @@ def test_indexing(self):
if LooseVersion(dask.__version__) >= LooseVersion("2021.04.0+17"):
arr = Variable(("x"), da.array([1, 2, 3, 4]))
expected = Variable(("x"), da.array([99, 2, 3, 4]))
arr[0] = 99
arr[0] = 99 # Indexing by integers
assert_identical(arr, expected)
arr = Variable(("x"), da.array([1, 2, 3, 4]))
expected = Variable(("x"), da.array([99, 99, 99, 4]))
arr[2::-1] = 99
arr[2::-1] = 99 # Indexing by slices
assert_identical(arr, expected)
arr = Variable(("x"), da.array([1, 2, 3, 4]))
expected = Variable(("x"), da.array([99, 99, 3, 99]))
arr[[0, -1, 1]] = 99
arr[[0, -1, 1]] = 99 # Indexing by a list of integers
assert_identical(arr, expected)
arr = Variable(("x"), da.array([1, 2, 3, 4]))
expected = Variable(("x"), da.array([99, 99, 99, 4]))
arr[np.arange(3)] = 99
arr[np.arange(3)] = 99 # Indexing by a 1-d numpy array of integers
assert_identical(arr, expected)
arr = Variable(("x"), da.array([1, 2, 3, 4]))
expected = Variable(("x"), da.array([1, 99, 99, 99]))
arr[[False, True, True, True]] = 99
arr[[False, True, True, True]] = 99 # Indexing by a list of booleans
assert_identical(arr, expected)
arr = Variable(("x"), da.array([1, 2, 3, 4]))
expected = Variable(("x"), da.array([1, 99, 99, 99]))
arr[np.arange(4) > 0] = 99
arr[np.arange(4) > 0] = 99 # Indexing by a 1-d numpy array of booleans
assert_identical(arr, expected)
arr = Variable(("x"), da.array([1, 2, 3, 4]))
expected = Variable(("x"), da.array([99, 99, 99, 99]))
arr[arr > 0] = 99
arr[arr > 0] = 99 # Indexing by one broadcastable Array of booleans
assert_identical(arr, expected)
else:
with raises_regex(TypeError, "stored in a dask array"):
with raises_regex(TypeError, match=r"stored in a dask array"):
dcherian marked this conversation as resolved.
Show resolved Hide resolved
v[:1] = 0

def test_squeeze(self):
Expand Down
1 change: 0 additions & 1 deletion xarray/tests/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,6 @@ def test_create_mask_error():
with raises_regex(TypeError, "unexpected key type"):
indexing.create_mask((1, 2), (3, 4))


@pytest.mark.parametrize(
"indices, expected",
[
Expand Down