Skip to content

Commit

Permalink
Fix Group.array() with data argument (#2668)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwhite authored Jan 7, 2025
1 parent bc5877b commit 12f6012
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/zarr/core/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -2729,6 +2729,8 @@ def array(
Whether to overwrite an array with the same name in the store, if one exists.
config : ArrayConfig or ArrayConfigLike, optional
Runtime configuration for the array.
data : array_like
The data to fill the array with.
Returns
-------
Expand All @@ -2737,7 +2739,7 @@ def array(
compressors = _parse_deprecated_compressor(compressor, compressors)
return Array(
self._sync(
self._async_group.create_array(
self._async_group.create_dataset(
name=name,
shape=shape,
dtype=dtype,
Expand All @@ -2754,6 +2756,7 @@ def array(
overwrite=overwrite,
storage_options=storage_options,
config=config,
data=data,
)
)
)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,7 @@ def test_group_create_array(
array[:] = data
elif method == "array":
with pytest.warns(DeprecationWarning):
array = group.array(name="array", shape=shape, dtype=dtype)
array[:] = data
array = group.array(name="array", data=data, shape=shape, dtype=dtype)
else:
raise AssertionError

Expand Down

0 comments on commit 12f6012

Please sign in to comment.