Skip to content

Commit bc45f47

Browse files
committed
ENH: Add auto_attr test
1 parent 37110cf commit bc45f47

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

nibabel/tests/test_onetime.py

+14
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,17 @@ def a(self):
1717
assert 'a' in x.__dict__
1818
# Each call to object() produces a unique object. Verify we get the same one every time.
1919
assert x.a is obj
20+
21+
22+
def test_auto_attr():
23+
class MagicProp:
24+
@auto_attr
25+
def a(self):
26+
return object()
27+
28+
x = MagicProp()
29+
assert 'a' not in x.__dict__
30+
obj = x.a
31+
assert 'a' in x.__dict__
32+
# Each call to object() produces a unique object. Verify we get the same one every time.
33+
assert x.a is obj

0 commit comments

Comments
 (0)