diff options
| author | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2008-11-19 15:17:10 +0100 |
|---|---|---|
| committer | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2008-11-19 15:17:10 +0100 |
| commit | b1495b12b66cdec3f2e6d2a1281a9ccf8ee2f827 (patch) | |
| tree | 3b1fec5751b5012a4635ecd0a56df64dadef0fff | |
| parent | 4fd99076a73873ac4f230c7400c80decacb2ea62 (diff) | |
| download | astroid-git-b1495b12b66cdec3f2e6d2a1281a9ccf8ee2f827.tar.gz | |
test decorator arguments lookup
| -rw-r--r-- | test/unittest_lookup.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/test/unittest_lookup.py b/test/unittest_lookup.py index 35890e1c..bf7bc427 100644 --- a/test/unittest_lookup.py +++ b/test/unittest_lookup.py @@ -168,7 +168,32 @@ class Test: obj = it.next() self.assertIsInstance(obj, nodes.Class) self.assertRaises(StopIteration, it.next) - + + def test_decorator_arguments_lookup(self): + if sys.version_info < (2, 4): + self.skip('this test require python >= 2.4') + data = ''' +def decorator(value): + def wrapper(function): + return function + return wrapper + +class foo: + member = 10 + + @decorator(member) #This will cause pylint to complain + def test(self): + pass + ''' + astng = builder.string_build(data, __name__, __file__) + member = get_name_node(astng['foo'], 'member') + print 'oop', member.lineno + it = member.infer() + obj = it.next() + self.assertIsInstance(obj, nodes.Const) + self.assertEquals(obj.value, 10) + self.assertRaises(StopIteration, it.next) + def test_nonregr_decorator_member_lookup(self): if sys.version_info < (2, 4): self.skip('this test require python >= 2.4') |
