diff options
| author | Michael Merickel <michael@merickel.org> | 2021-02-20 14:43:40 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-20 14:43:40 -0600 |
| commit | ea3050858e4542fc12a3208d9a142eec8b0706cf (patch) | |
| tree | e31a5d7fa12f509cef5ecb6feee94cf3d29cc4c2 /tests/test_decorator.py | |
| parent | 5b63fb8ecff82d448970b7e2d7b9dd078d4ed438 (diff) | |
| parent | 24ea7860842f0d5ac366732f5921dde1e285cdf7 (diff) | |
| download | pyramid-ea3050858e4542fc12a3208d9a142eec8b0706cf.tar.gz pyramid-ea3050858e4542fc12a3208d9a142eec8b0706cf.tar.bz2 pyramid-ea3050858e4542fc12a3208d9a142eec8b0706cf.zip | |
Merge pull request #3657 from luhn/reify-sphinx
Remove update_wrapper from reify
Diffstat (limited to 'tests/test_decorator.py')
| -rw-r--r-- | tests/test_decorator.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_decorator.py b/tests/test_decorator.py index b9a1f1e9d..0da8380f8 100644 --- a/tests/test_decorator.py +++ b/tests/test_decorator.py @@ -1,3 +1,4 @@ +import inspect import unittest @@ -25,6 +26,28 @@ class TestReify(unittest.TestCase): result = decorator.__get__(None) self.assertEqual(result, decorator) + def test_copy_docstring(self): + def wrapped(inst): + """Test doc""" + return 'a' # pragma: no cover + + decorator = self._makeOne(wrapped) + assert decorator.__doc__ == 'Test doc' + + def test_not_function(self): + """ + Because reify'd methods act as attributes, it's important that they + aren't recognized as a function. Otherwise tools like Sphinx may + misbehave, like in https://github.com/Pylons/pyramid/issues/3655 + + """ + + def wrapped(inst): + return 'a' # pragma: no cover + + decorator = self._makeOne(wrapped) + assert not inspect.isfunction(decorator) + class Dummy: pass |
