Skip to content

Commit 52f0abc

Browse files
committed
Fix string itemsize in tests for zarr-python v3
1 parent 1e19459 commit 52f0abc

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

tests/test_vcz.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
from bio2zarr import vcf as vcf_mod
1414
from bio2zarr.zarr_utils import zarr_v3
1515

16+
# In zarr-python v2 strings are stored as object arrays (O) with itemsize 8
17+
# In zarr-python v3 strings are stored as string arrays (T) with itemsize 16
18+
STRING_ITEMSIZE = 16 if zarr_v3() else 8
19+
1620

1721
@pytest.fixture(scope="module")
1822
def vcf_file():
@@ -292,9 +296,8 @@ class TestChunkNbytes:
292296
("variant_position", 36), # 9 * 4
293297
("variant_H2", 9),
294298
("variant_AC", 18), # 9 * 2
295-
# Object fields have an itemsize of 8
296-
("variant_AA", 72), # 9 * 8
297-
("variant_allele", 9 * 4 * 8),
299+
("variant_AA", 9 * STRING_ITEMSIZE),
300+
("variant_allele", 9 * 4 * STRING_ITEMSIZE),
298301
],
299302
)
300303
def test_example_schema(self, schema, field, value):

0 commit comments

Comments
 (0)