diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2015-10-26 12:47:55 +0000 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2015-10-26 12:47:55 +0000 |
commit | 9466d0789b6f30d39aa7a5b63fa7ee04d5785336 (patch) | |
tree | f70a16459b30062852b632aeae96337ad2353d76 /pylint | |
parent | 60ca6a05b00dae33c0210df4e8f7c89c63d459b3 (diff) | |
download | pylint-9466d0789b6f30d39aa7a5b63fa7ee04d5785336.tar.gz |
Add test for verifying that __name__ can't be accessed from an instance.
Diffstat (limited to 'pylint')
-rw-r--r-- | pylint/test/functional/member_checks.py | 6 | ||||
-rw-r--r-- | pylint/test/functional/member_checks.txt | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/pylint/test/functional/member_checks.py b/pylint/test/functional/member_checks.py index 8838fae..50a0d97 100644 --- a/pylint/test/functional/member_checks.py +++ b/pylint/test/functional/member_checks.py @@ -173,3 +173,9 @@ def no_conjugate_member(magic_flag): if isinstance(something, float): return something return something.conjugate() + + +class NoDunderNameInInstance(object): + """Emit a warning when accessing __name__ from an instance.""" + def __init__(self): + self.var = self.__name__ # [no-member] diff --git a/pylint/test/functional/member_checks.txt b/pylint/test/functional/member_checks.txt index 3d50a25..6e527bc 100644 --- a/pylint/test/functional/member_checks.txt +++ b/pylint/test/functional/member_checks.txt @@ -15,3 +15,4 @@ no-member:120::Class 'Client' has no 'missing' member:INFERENCE no-member:144::Class 'Client' has no 'ala' member:INFERENCE no-member:145::Class 'dict' has no 'bala' member:INFERENCE no-member:146::Class 'str' has no 'portocala' member:INFERENCE +no-member:181:NoDunderNameInInstance.__init__:Instance of 'NoDunderNameInInstance' has no '__name__' member:INFERENCE
\ No newline at end of file |