diff options
| author | Michele Simionato <michele.simionato@gmail.com> | 2015-07-28 05:38:28 +0200 |
|---|---|---|
| committer | Michele Simionato <michele.simionato@gmail.com> | 2015-07-28 05:38:28 +0200 |
| commit | 96e90441b1cf47b660b8cef935163aa24d6ced0f (patch) | |
| tree | b95e8bb634673943e5af5560b65972d16badd421 /src/tests | |
| parent | 0726464b1259505f532f2e8ffe38785600520603 (diff) | |
| download | python-decorator-git-96e90441b1cf47b660b8cef935163aa24d6ced0f.tar.gz | |
__qualname__ should be added only for Python >= 3.3
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/documentation.py | 12 | ||||
| -rw-r--r-- | src/tests/test.py | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/tests/documentation.py b/src/tests/documentation.py index 350f05c..81602c8 100644 --- a/src/tests/documentation.py +++ b/src/tests/documentation.py @@ -611,11 +611,11 @@ having to rewrite them in terms of ``decorator``. You can use a $$decorator_apply -``decorator_apply`` sets the attribute ``__wrapped__`` of the generated -function to the original function, so that you can get the right -source code. If you are using Python 3, you should also set the -``__qualname__`` attribute to preserve the qualified name of the -original function. +``decorator_apply`` sets the attribute ``__wrapped__`` of the +generated function to the original function, so that you can get the +right source code. If you are using a Python more recent than 3.2, you +should also set the ``__qualname__`` attribute to preserve the +qualified name of the original function. Notice that I am not providing this functionality in the ``decorator`` module directly since I think it is best to rewrite the decorator rather @@ -1122,7 +1122,7 @@ Here ``f.__wrapped__`` is the original undecorated function. Such an attribute is added to be consistent with the way ``functools.update_wrapper`` work. Another attribute which is copied from the original function is ``__qualname__``, the qualified name. This is an attribute which is -present only in Python 3. +present starting from Python 3.3. """ import sys diff --git a/src/tests/test.py b/src/tests/test.py index 9428fa9..45a9b9b 100644 --- a/src/tests/test.py +++ b/src/tests/test.py @@ -41,12 +41,12 @@ class DocumentationTestCase(unittest.TestCase): class ExtraTestCase(unittest.TestCase): def test_qualname(self): - if sys.version >= '3': + if sys.version >= '3.3': self.assertEqual(doc.hello.__qualname__, 'hello') else: with assertRaises(AttributeError): doc.hello.__qualname__ - + def test_signature(self): if hasattr(inspect, 'signature'): sig = inspect.signature(doc.f1) |
