From 6421c95df1d2895e36c3320146d44153e4a52ceb Mon Sep 17 00:00:00 2001 From: David Halter Date: Sat, 10 Aug 2013 22:52:20 +0430 Subject: [PATCH] tests for init decorator problem, see #247 --- test/completion/decorators.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/completion/decorators.py b/test/completion/decorators.py index 7dfe1608..1d055544 100644 --- a/test/completion/decorators.py +++ b/test/completion/decorators.py @@ -116,6 +116,31 @@ MethodDecoratorAsClass().func_without_self('')[1] MethodDecoratorAsClass().func_with_self(1) +class SelfVars(): + """Init decorator problem as an instance, #247""" + @Decorator + def __init__(self): + """ + init decorators should be ignored when looking up variables in the + class. + """ + self.c = list + + @Decorator + def shouldnt_expose_var(not_self): + """ + Even though in real Python this shouldn't expose the variable, in this + case Jedi exposes the variable, because these kind of decorators are + normally descriptors, which SHOULD be exposed (at least 90%). + """ + not_self.b = 1.0 + + def other_method(self): + #? float() + self.b + #? list + self.c + # ----------------- # not found decorators (are just ignored) # -----------------