Skip to content

Commit e7d5f39

Browse files
gsakkisalimanfoo
andauthored
Fix N5Store.__contains__ (#550)
* Fix N5Store.__contains__ * added release note Co-authored-by: Alistair Miles <[email protected]>
1 parent 692f8e6 commit e7d5f39

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

docs/release.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Release notes
22
=============
33

4+
5+
Next release
6+
------------
7+
8+
* Fix minor bug in `N5Store`.
9+
By :user:`gsakkis`, :issue:`550`.
10+
11+
412
.. _release_2.4.0:
513

614
2.4.0

zarr/n5.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ def __contains__(self, key):
175175
# array if attributes contain 'dimensions'
176176
return 'dimensions' in self._load_n5_attrs(key)
177177

178-
elif key.endswith(zarr_attrs_key): # pragma: no cover
178+
elif key.endswith(zarr_attrs_key):
179179

180-
key = key.replace(zarr_array_meta_key, n5_attrs_key)
180+
key = key.replace(zarr_attrs_key, n5_attrs_key)
181181
return self._contains_attrs(key)
182182

183183
elif is_chunk_key(key):

zarr/tests/test_core.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,9 +1255,12 @@ def test_endian(self):
12551255
def test_attributes(self):
12561256
a = self.create_array(shape=10, chunks=10, dtype='i8')
12571257
a.attrs['foo'] = 'bar'
1258+
assert a.attrs.key in a.store
12581259
attrs = json_loads(a.store[a.attrs.key])
12591260
assert 'foo' in attrs and attrs['foo'] == 'bar'
1261+
12601262
a.attrs['bar'] = 'foo'
1263+
assert a.attrs.key in a.store
12611264
attrs = json_loads(a.store[a.attrs.key])
12621265
assert 'foo' in attrs and attrs['foo'] == 'bar'
12631266
assert 'bar' in attrs and attrs['bar'] == 'foo'

0 commit comments

Comments
 (0)