Add __getattr__ checks with proper inheritance.

This commit is contained in:
Dave Halter
2014-06-26 12:56:01 +02:00
parent a936cea987
commit 4238538df4
2 changed files with 28 additions and 3 deletions

View File

@@ -0,0 +1,24 @@
"""
Jedi issues warnings for possible errors if ``__getattr__``,
``__getattribute__`` or ``setattr`` are used.
"""
class Cls():
def __getattr__(self, name):
return getattr(str, name)
Cls().upper
#! 6 warning attribute-error
Cls().undefined
class Inherited(Cls):
pass
Inherited().upper
#! 12 warning attribute-error
Inherited().undefined