8000 optimize code by using create function · zarr-developers/zarr-python@fd0f691 · GitHub
[go: up one dir, main page]

Skip to content

Commit fd0f691

Browse files
committed
optimize code by using create function
1 parent fb122ec commit fd0f691

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

zarr/tests/test_n5.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
import pytest
33

44
from zarr.n5 import N5ChunkWrapper, N5FSStore
5-
from zarr.storage import MemoryStore
5+
from zarr.creation import create
66
from numcodecs import GZip
77
import numpy as np
88
from typing import Tuple
99
import shutil
1010
import json
11-
import zarr
1211

1312

1413
def test_make_n5_chunk_wrapper():
@@ -44,12 +43,8 @@ def test_partial_chunk_decode(chunk_shape: Tuple[int, ...]):
4443
def test_dtype_decode():
4544
store = 'data/array.n5'
4645
n5_store = N5FSStore(store)
47-
z = zarr.open(n5_store)
48-
z.create_dataset("test", shape=100, dtype="u1")
46+
create(100, store=n5_store)
4947
dtype_n5 = json.loads(n5_store["test/.zarray"])["dtype"]
5048
shutil.rmtree(store)
51-
zarr_store = MemoryStore()
52-
z = zarr.open(zarr_store)
53-
z.create_dataset("test", shape=100, dtype="u1")
54-
dtype_zarr = json.loads(zarr_store["test/.zarray"])["dtype"]
49+
dtype_zarr = json.loads(create(100).store["test/.zarray"])["dtype"]
5550
assert dtype_n5 == dtype_zarr

0 commit comments

Comments
 (0)
0