diff options
| author | Michele Simionato <michele.simionato@gmail.com> | 2015-07-28 05:33:20 +0200 |
|---|---|---|
| committer | Michele Simionato <michele.simionato@gmail.com> | 2015-07-28 05:33:20 +0200 |
| commit | 0726464b1259505f532f2e8ffe38785600520603 (patch) | |
| tree | 782fe29bafebcf47c559e72bcb89fb6384646e0c /src/tests | |
| parent | dbde4e468d931401cce0b359088b5cf8f840539a (diff) | |
| download | python-decorator-git-0726464b1259505f532f2e8ffe38785600520603.tar.gz | |
Fixed bug with __qualname__
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/documentation.py | 5 | ||||
| -rw-r--r-- | src/tests/test.py | 7 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/tests/documentation.py b/src/tests/documentation.py index e82ba8e..350f05c 100644 --- a/src/tests/documentation.py +++ b/src/tests/documentation.py @@ -1121,9 +1121,8 @@ You can check that the ``__annotations__`` dictionary is preserved: 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 a concept introduced -in Python 3. In Python 2 the decorator module will still add a -qualified name, but its value will always be ``None``. +``__qualname__``, the qualified name. This is an attribute which is +present only in Python 3. """ import sys diff --git a/src/tests/test.py b/src/tests/test.py index 951958c..9428fa9 100644 --- a/src/tests/test.py +++ b/src/tests/test.py @@ -40,6 +40,13 @@ class DocumentationTestCase(unittest.TestCase): class ExtraTestCase(unittest.TestCase): + def test_qualname(self): + if sys.version >= '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) |
