コード例 #1
0
ファイル: test_util.py プロジェクト: eigenhombre/hy
def test_temporary_attribute_value():
    class O(object):
        def __init__(self):
            self.foobar = 0

    o = O()

    with util.temporary_attribute_value(o, "foobar", 42):
        assert o.foobar == 42
    assert o.foobar == 0
コード例 #2
0
ファイル: compiler.py プロジェクト: koo5/hy
 def is_returnable(self, v):
     return temporary_attribute_value(self, "returnable", v)
コード例 #3
0
 def is_returnable(self, v):
     return temporary_attribute_value(self, "returnable", v)