Skip to content

Commit

Permalink
test and fix indexing for scalar arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
brokkoli71 committed Dec 22, 2024
1 parent f360fc6 commit e314f54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/zarr/api/asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ async def array(
z = await create(**kwargs)

# fill with data
await z.setitem(slice(None), data)
await z.setitem(Ellipsis, data)

return z

Expand Down
7 changes: 7 additions & 0 deletions tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,3 +782,10 @@ async def test_special_complex_fill_values_roundtrip(fill_value: Any, expected:
assert content is not None
actual = json.loads(content.to_bytes())
assert actual["fill_value"] == expected


async def test_scalar_array():
arr = zarr.array(1.5)
assert arr[...] == 1.5
assert arr[()] == 1.5
assert arr.shape == ()

0 comments on commit e314f54

Please sign in to comment.