hy/tests/test_util.py
Julien Danjou 7066d53b02 Introduce a context manager for compiler.returnable
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-21 17:14:26 +02:00

14 lines
264 B
Python

from hy import util
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