Skip to content

Commit 057ee4e

Browse files
committed
More tests for Expando
1 parent 33bb208 commit 057ee4e

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/bd2k/util/expando.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,27 @@ class Expando(dict):
3636
3737
>>> json.dumps(o)
3838
'{"foo": 42, "bar": "hi"}'
39+
40+
Attributes can be deleted, too:
41+
42+
>>> o = Expando(foo=42)
43+
>>> o.foo
44+
42
45+
>>> del o.foo
46+
>>> o.foo
47+
Traceback (most recent call last):
48+
...
49+
AttributeError: 'Expando' object has no attribute 'foo'
50+
>>> o['foo']
51+
Traceback (most recent call last):
52+
...
53+
KeyError: 'foo'
54+
55+
>>> del o.foo
56+
Traceback (most recent call last):
57+
...
58+
AttributeError: foo
59+
3960
"""
4061

4162
def __init__( self, *args, **kwargs ):

0 commit comments

Comments
 (0)