Skip to content

Commit

Permalink
annotate store variables as Store
Browse files Browse the repository at this point in the history
  • Loading branch information
d-v-b committed Oct 31, 2024
1 parent 426e1cb commit 0013d22
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ async def test_open_array(store: Store, zarr_format: ZarrFormat) -> None:
assert isinstance(z, Array)
assert z.shape == (100,)

store_w: Store

if isinstance(store, ZipStore):
store.close()
store_w = await ZipStore.open(store.path, mode="w")
Expand All @@ -81,6 +83,8 @@ async def test_open_array(store: Store, zarr_format: ZarrFormat) -> None:
assert isinstance(z, Array)
assert z.shape == (200,)

store_r: Store

if isinstance(store, ZipStore):
store_w.close()
store_r = await ZipStore.open(store.path, mode="r")
Expand Down Expand Up @@ -121,6 +125,7 @@ async def test_open_group(store: Store) -> None:
# g = open_group(store=store)
# assert isinstance(g, Group)
# assert "foo" not in g
store_r: Store

# open group, read-only
if isinstance(store, ZipStore):
Expand Down Expand Up @@ -148,6 +153,8 @@ async def test_open_array_or_group(zarr_format: ZarrFormat, store: Store) -> Non
grp_w = group(store=store, path="group", zarr_format=zarr_format, attributes=grp_attrs)
arr_w = grp_w.create_array(name="foo", shape=(1,))

store_2: Store

if isinstance(store, ZipStore):
store.close()
store_2 = await ZipStore.open(store.path, mode="r")
Expand Down Expand Up @@ -176,7 +183,7 @@ async def test_open_group_unspecified_version(store: Store, zarr_format: ZarrFor
_ = await zarr.api.asynchronous.open_group(
store=store, mode="a", zarr_format=zarr_format, attributes={"foo": "bar"}
)

store_2: Store
if isinstance(store, ZipStore):
store.close()
store_2 = await ZipStore.open(store.path, mode="r")
Expand Down

0 comments on commit 0013d22

Please sign in to comment.