Skip to content

Commit 202d606

Browse files
committed
Add test
1 parent a1949f1 commit 202d606

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

tests/test_common.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING
4-
5-
if TYPE_CHECKING:
6-
from collections.abc import Iterable
7-
from typing import Any, Literal
3+
from typing import TYPE_CHECKING, get_args
84

95
import numpy as np
106
import pytest
117

12-
from zarr.core.common import parse_name, parse_shapelike, product
8+
from zarr.core.common import (
9+
ANY_ACCESS_MODE,
10+
AccessModeLiteral,
11+
parse_name,
12+
parse_shapelike,
13+
product,
14+
)
1315
from zarr.core.config import parse_indexing_order
1416

17+
if TYPE_CHECKING:
18+
from collections.abc import Iterable
19+
from typing import Any, Literal
20+
1521

1622
@pytest.mark.parametrize("data", [(0, 0, 0, 0), (1, 3, 4, 5, 6), (2, 4)])
1723
def test_product(data: tuple[int, ...]) -> None:
1824
assert product(data) == np.prod(data)
1925

2026

27+
def test_access_modes() -> None:
28+
"""
29+
Test that the access modes type and variable for run-time checking are equivalent.
30+
"""
31+
assert set(ANY_ACCESS_MODE) == set(get_args(AccessModeLiteral))
32+
33+
2134
# todo: test
2235
def test_concurrent_map() -> None: ...
2336

0 commit comments

Comments
 (0)