Skip to content

Commit

Permalink
rollback to simple version
Browse files Browse the repository at this point in the history
  • Loading branch information
jhamman committed Oct 23, 2024
1 parent 6e8f3da commit 4ab2698
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
2 changes: 1 addition & 1 deletion src/zarr/api/asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ async def save_array(
if np.isscalar(arr):
arr = np.array(arr)
shape = arr.shape
chunks = getattr(arr, "chunks", shape) # for array-likes with chunks attribute
chunks = getattr(arr, "chunks", None) # for array-likes with chunks attribute
new = await AsyncArray.create(
store_path,
zarr_format=zarr_format,
Expand Down
31 changes: 0 additions & 31 deletions tests/test_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,37 +447,6 @@ def test_group_setitem(store: Store, zarr_format: ZarrFormat) -> None:
assert group[key].shape == (3, 5)
np.testing.assert_array_equal(group[key], arr)

# overwrite with a scalar
# separate bug!
# group["key"] = 1.5
# assert group["key"].shape == ()
# assert group["key"][:] == 1


def test_group_arrays_setter(store: Store, zarr_format: ZarrFormat) -> None:
"""
Test the `Group.__setitem__` method.
"""
group = Group.from_store(store, zarr_format=zarr_format)
arr = np.ones((2, 4))
group.arrays["key"] = arr
assert group["key"].shape == (2, 4)
np.testing.assert_array_equal(group["key"][:], arr)

if store.supports_deletes:
key = "key"
else:
# overwriting with another array requires deletes
# for stores that don't support this, we just use a new key
key = "key2"

# overwrite with another array
arr = np.zeros((3, 5))
with pytest.warns(DeprecationWarning):
group[key] = arr
assert group[key].shape == (3, 5)
np.testing.assert_array_equal(group[key], arr)


def test_group_contains(store: Store, zarr_format: ZarrFormat) -> None:
"""
Expand Down

0 comments on commit 4ab2698

Please sign in to comment.