blob: 834f6db437f3cf259f7e0019a4079ef0a5c9aac7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import pytest
from yarl._url import cached_property
class A:
def __init__(self):
self._cache = {}
@cached_property
def prop(self):
"""Docstring."""
return 1
def test_reify():
a = A()
assert 1 == a.prop
def test_reify_class():
assert isinstance(A.prop, cached_property)
assert "Docstring." == A.prop.__doc__
def test_reify_assignment():
a = A()
with pytest.raises(AttributeError):
a.prop = 123
|