Skip to content

Commit 8646227

Browse files
committed
test coverage for h5py compat; fix Group docstring
1 parent 030e251 commit 8646227

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

docs/api/hierarchy.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,9 @@ Groups (``zarr.hierarchy``)
88
.. autoclass:: Group
99

1010
.. automethod:: __len__
11+
.. automethod:: __iter__
1112
.. automethod:: __contains__
1213
.. automethod:: __getitem__
13-
.. automethod:: __setitem__
14-
.. automethod:: __iter__
15-
.. automethod:: keys
16-
.. automethod:: values
17-
.. automethod:: items
1814
.. automethod:: group_keys
1915
.. automethod:: groups
2016
.. automethod:: array_keys

zarr/hierarchy.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,9 @@ class Group(Mapping):
4141
Methods
4242
-------
4343
__len__
44+
__iter__
4445
__contains__
4546
__getitem__
46-
__setitem__
47-
__iter__
48-
keys
49-
values
50-
items
5147
group_keys
5248
groups
5349
array_keys
@@ -509,7 +505,7 @@ def create_dataset(self, name, data=None, shape=None, chunks=None,
509505
# N.B., additional kwargs are included in method signature to
510506
# improve compatibility for users familiar with h5py and adapting
511507
# code that previously used h5py. These keyword arguments are
512-
# ignored here but we raise a warning to let the user know.
508+
# ignored here but we issue a warning to let the user know.
513509
for k in kwargs:
514510
if k == 'fillvalue':
515511
warn("ignoring keyword argument %r; please use 'fill_value' "

zarr/tests/test_hierarchy.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,12 @@ def test_create_errors(self):
285285
with assert_raises(KeyError):
286286
g.require_dataset('c/d', shape=100, chunks=10)
287287

288+
# h5py compatibility - accept but ingore some keyword args
289+
d = g.create_dataset('x', shape=100, chunks=10, fillvalue=1)
290+
assert_is_none(d.fill_value)
291+
d = g.create_dataset('y', shape=100, chunks=10, shuffle=True)
292+
assert not hasattr(d, 'shuffle')
293+
288294
# read-only
289295
g = Group(store=store, readonly=True)
290296
with assert_raises(ReadOnlyError):

0 commit comments

Comments
 (0)