def f(x):
    try:
        from foo import Bar #pass
    except ImportError:
        class Bar(object):
            pass
    return Bar()
예제 #2
0
from foo import Boo
from foo import Bar

boo = Boo()
bar = Bar()

boo.printBoo()
bar.printBar()
예제 #3
0
def test_copyable():
    copybar = Bar(UMSCM({"foo": 42, "bar": -1}))
    assert dict(copybar.m_map) == {"foo": 42, "bar": -1}
    copybar.m_map["foo"] = -1
    copybar.m_map["baz"] = 1337
    assert dict(copybar.m_map) == {"foo": -1, "bar": -1, "baz": 1337}
예제 #4
0
def test_moveonly():
    movebar = Bar("foo", 42)  # this makes a MoveOnlyMemberMap
    assert movebar.m_map  # we can only assert that the member map exists