当前位置: 首页>>代码示例>>Python>>正文


Python Munch.hello方法代码示例

本文整理汇总了Python中munch.Munch.hello方法的典型用法代码示例。如果您正苦于以下问题:Python Munch.hello方法的具体用法?Python Munch.hello怎么用?Python Munch.hello使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在munch.Munch的用法示例。


在下文中一共展示了Munch.hello方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_contains

# 需要导入模块: from munch import Munch [as 别名]
# 或者: from munch.Munch import hello [as 别名]
def test_contains():
    b = Munch(ponies='are pretty!')
    assert 'ponies' in b
    assert ('foo' in b) is False

    b['foo'] = 42
    assert 'foo' in b

    b.hello = 'hai'
    assert 'hello' in b

    b[None] = 123
    assert None in b

    b[False] = 456
    assert False in b
开发者ID:Infinidat,项目名称:munch,代码行数:18,代码来源:test_munch.py

示例2: test_base

# 需要导入模块: from munch import Munch [as 别名]
# 或者: from munch.Munch import hello [as 别名]
def test_base():
    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!')]

    assert "The {knights} who say {ni}!".format(**Munch(knights='lolcats', ni='can haz')) == 'The lolcats who say can haz!'
开发者ID:Infinidat,项目名称:munch,代码行数:20,代码来源:test_munch.py

示例3: test_base

# 需要导入模块: from munch import Munch [as 别名]
# 或者: from munch.Munch import hello [as 别名]
def test_base():
    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!")]

    assert (
        "The {knights} who say {ni}!".format(**Munch(knights="lolcats", ni="can haz")) == "The lolcats who say can haz!"
    )
开发者ID:mbarrien,项目名称:munch,代码行数:22,代码来源:test_munch.py


注:本文中的munch.Munch.hello方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。