mirror of
https://gitee.com/open-loongarch/buildroot-2024.08.git
synced 2026-10-28 05:57:13 +08:00
first commit: base 2024.08
Signed-off-by: maoxiaochuan <maoxiaochuan@loongson.cn>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
from munch import Munch
|
||||
|
||||
b = Munch()
|
||||
b.hello = 'world'
|
||||
assert b.hello == 'world'
|
||||
b['hello'] += "!"
|
||||
assert b.hello == 'world!'
|
||||
b.foo = Munch(lol=True)
|
||||
assert b.foo.lol is True
|
||||
assert b.foo is b['foo']
|
||||
|
||||
assert sorted(b.keys()) == ['foo', 'hello']
|
||||
|
||||
b.update({'ponies': 'are pretty!'}, hello=42)
|
||||
assert b == Munch({'ponies': 'are pretty!', 'foo': Munch({'lol': True}), 'hello': 42})
|
||||
|
||||
assert sorted([(k, b[k]) for k in b]) == [('foo', Munch({'lol': True})), ('hello', 42), ('ponies', 'are pretty!')]
|
||||
|
||||
format_munch = Munch(knights='lolcats', ni='can haz')
|
||||
assert "The {knights} who say {ni}!".format(**format_munch) == 'The lolcats who say can haz!'
|
||||
Reference in New Issue
Block a user