Skip to content

Commit e314f54

Browse files
committed
test and fix indexing for scalar arrays
1 parent f360fc6 commit e314f54

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/zarr/api/asynchronous.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ async def array(
574574
z = await create(**kwargs)
575575

576576
# fill with data
577-
await z.setitem(slice(None), data)
577+
await z.setitem(Ellipsis, data)
578578

579579
return z
580580

tests/test_array.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,3 +782,10 @@ async def test_special_complex_fill_values_roundtrip(fill_value: Any, expected:
782782
assert content is not None
783783
actual = json.loads(content.to_bytes())
784784
assert actual["fill_value"] == expected
785+
786+
787+
async def test_scalar_array():
788+
arr = zarr.array(1.5)
789+
assert arr[...] == 1.5
790+
assert arr[()] == 1.5
791+
assert arr.shape == ()

0 commit comments

Comments
 (0)