mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
Add __getattr__ checks with proper inheritance.
This commit is contained in:
24
test/static_analysis/attribute_warnings.py
Normal file
24
test/static_analysis/attribute_warnings.py
Normal 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
|
||||
Reference in New Issue
Block a user