summaryrefslogtreecommitdiff
path: root/tests/unittest_checker_variables.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittest_checker_variables.py')
-rw-r--r--tests/unittest_checker_variables.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/unittest_checker_variables.py b/tests/unittest_checker_variables.py
index b594e7d18..f33dbf8af 100644
--- a/tests/unittest_checker_variables.py
+++ b/tests/unittest_checker_variables.py
@@ -119,6 +119,32 @@ class TestVariablesChecker(CheckerTestCase):
with self.assertAddsMessages(msg):
self.checker.visit_global(node)
+ def test_listcomp_in_decorator(self):
+ """ Make sure class attributes in scope for listcomp in decorator.
+
+ https://github.com/PyCQA/pylint/issues/511
+ """
+ module = astroid.parse(
+ """
+ def dec(inp):
+ def inner(func):
+ print(inp)
+ return func
+ return inner
+
+
+ class Cls:
+
+ DATA = "foo"
+
+ @dec([x for x in DATA])
+ def fun(self):
+ pass
+ """
+ )
+ with self.assertNoMessages():
+ self.walk(module)
+
class TestVariablesCheckerWithTearDown(CheckerTestCase):