Here are the examples of the python api aiohttp.helpers.reify taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
3
Example 1
def test_reify(self):
class A:
def __init__(self):
self._cache = {}
@helpers.reify
def prop(self):
return 1
a = A()
assert 1 == a.prop
3
Example 2
Project: aiohttp Source File: test_helpers.py
def test_reify_class(self):
class A:
def __init__(self):
self._cache = {}
@helpers.reify
def prop(self):
"""Docstring."""
return 1
assert isinstance(A.prop, helpers.reify)
assert 'Docstring.' == A.prop.__doc__
3
Example 3
Project: aiohttp Source File: test_helpers.py
def test_reify_assignment(self):
class A:
def __init__(self):
self._cache = {}
@helpers.reify
def prop(self):
return 1
a = A()
with pytest.raises(AttributeError):
a.prop = 123