summaryrefslogtreecommitdiff
path: root/tests/functional/d/decorator_scope.py
blob: 8d35159e98af0de4fe6b819b2b817938ab95cb44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# -*- pylint: disable=W0232,R0903, useless-object-inheritance
"""Test that decorators sees the class namespace - just like
function default values does but function body doesn't.

https://www.logilab.net/elo/ticket/3711 - bug finding decorator arguments
https://www.logilab.net/elo/ticket/5626 - name resolution bug inside classes
"""

from __future__ import print_function

class Test(object):
    """test class"""
    ident = lambda x: x

    @ident(ident)
    def method(self, val=ident(7), func=ident):
        """hop"""
        print(self)
        return func(val)