Skip to content

Commit 4ed5171

Browse files
authored
Test store keys are all text (#408)
1 parent 4f00646 commit 4ed5171

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

zarr/tests/test_core.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,21 @@ def create_array(self, read_only=False, **kwargs):
8686
return Array(store, read_only=read_only, cache_metadata=cache_metadata,
8787
cache_attrs=cache_attrs)
8888

89+
def test_store_has_text_keys(self):
90+
# Initialize array
91+
np.random.seed(42)
92+
z = self.create_array(shape=(1050,), chunks=100, dtype='f8', compressor=[])
93+
z[:] = np.random.random(z.shape)
94+
95+
if PY2: # pragma: py3 no cover
96+
expected_type = (str, text_type)
97+
else: # pragma: py2 no cover
98+
expected_type = text_type
99+
100+
for k in z.chunk_store.keys():
101+
if not isinstance(k, expected_type): # pragma: no cover
102+
pytest.fail("Non-text key: %s" % repr(k))
103+
89104
def test_store_has_binary_values(self):
90105
# Initialize array
91106
np.random.seed(42)

0 commit comments

Comments
 (0)