Skip to content

Commit bbc6da6

Browse files
committed
test put attributes
1 parent 14f2189 commit bbc6da6

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

zarr/attrs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def _update_nosync(self, *args, **kwargs):
115115

116116
def keys(self):
117117
return self.asdict().keys()
118-
118+
119119
def __iter__(self):
120120
return iter(self.asdict())
121121

zarr/tests/test_attrs.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,25 @@ def test_get_set_del_contains(self):
4646
del a['foo']
4747
assert 'foo' not in a
4848
with assert_raises(KeyError):
49+
# noinspection PyStatementEffect
4950
a['foo']
5051

51-
def test_update(self):
52+
def test_update_put(self):
5253

5354
a = self.init_attributes(dict())
5455
assert 'foo' not in a
56+
assert 'bar' not in a
57+
assert 'baz' not in a
58+
59+
a.update(foo='spam', bar=42, baz=4.2)
60+
eq(a['foo'], 'spam')
61+
eq(a['bar'], 42)
62+
eq(a['baz'], 4.2)
63+
64+
a.put(dict(foo='eggs', bar=84))
65+
eq(a['foo'], 'eggs')
66+
eq(a['bar'], 84)
5567
assert 'baz' not in a
56-
a.update(foo='bar', baz=42)
57-
eq(a['foo'], 'bar')
58-
eq(a['baz'], 42)
5968

6069
def test_iterators(self):
6170

0 commit comments

Comments
 (0)