summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Piercy <web@stevepiercy.com>2016-07-04 14:11:54 -0700
committerGitHub <noreply@github.com>2016-07-04 14:11:54 -0700
commit7909e9503cdfc6f6e84d2c7ace1d3c03ca1d8b73 (patch)
treed4ea649a3d83fdcbe18298c8880368ba34f006ce
parente16832d028daf94642df7739f78b4f58d8c306c8 (diff)
parent2061971ccddff626fc435b16f0afabefee9a260e (diff)
downloadpyramid-7909e9503cdfc6f6e84d2c7ace1d3c03ca1d8b73.tar.gz
pyramid-7909e9503cdfc6f6e84d2c7ace1d3c03ca1d8b73.tar.bz2
pyramid-7909e9503cdfc6f6e84d2c7ace1d3c03ca1d8b73.zip
Merge pull request #2676 from stevepiercy/master
Show testsetup code in rendered docs the right way.
-rw-r--r--pyramid/decorator.py31
1 files changed, 9 insertions, 22 deletions
diff --git a/pyramid/decorator.py b/pyramid/decorator.py
index e3a8c707f..065a3feed 100644
--- a/pyramid/decorator.py
+++ b/pyramid/decorator.py
@@ -6,31 +6,18 @@ class reify(object):
Python ``@property`` decorator, but it puts the result of the method it
decorates into the instance dict after the first call, effectively
replacing the function it decorates with an instance variable. It is, in
- Python parlance, a non-data descriptor. An example:
+ Python parlance, a non-data descriptor. The following is an example and
+ its usage:
- .. code-block:: python
-
- from pyramid.decorator import reify
-
- class Foo(object):
- @reify
- def jammy(self):
- print('jammy called')
- return 1
-
- .. testsetup::
-
- from pyramid.decorator import reify
-
- class Foo(object):
- @reify
- def jammy(self):
- print('jammy called')
- return 1
+ .. doctest::
- And usage of Foo:
+ >>> from pyramid.decorator import reify
- .. doctest::
+ >>> class Foo(object):
+ ... @reify
+ ... def jammy(self):
+ ... print('jammy called')
+ ... return 1
>>> f = Foo()
>>> v = f.jammy