diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-06-01 00:39:36 +0300 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-06-01 00:39:36 +0300 |
commit | 7bc82747f61593276de136b302b319d402bb010a (patch) | |
tree | 8a2aaab27ed84f7e38422c248f2d070a94bb9091 /pylint/test/functional/super_checks.py | |
parent | 4fed07cf9dd2e7096c960469b6c824533ce277ec (diff) | |
download | pylint-7bc82747f61593276de136b302b319d402bb010a.tar.gz |
Add tests for checking the new understanding of super calls.
Diffstat (limited to 'pylint/test/functional/super_checks.py')
-rw-r--r-- | pylint/test/functional/super_checks.py | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/pylint/test/functional/super_checks.py b/pylint/test/functional/super_checks.py index a2319fe..14fd5a2 100644 --- a/pylint/test/functional/super_checks.py +++ b/pylint/test/functional/super_checks.py @@ -1,4 +1,4 @@ -# pylint: disable=too-few-public-methods,import-error, no-absolute-import +# pylint: disable=too-few-public-methods,import-error, no-absolute-import,missing-docstring """check use of super""" from unknown import Missing @@ -68,3 +68,31 @@ class UnknownBases(Missing): # pylint: disable=super-on-old-class super(UnknownBases, self).__init__() super(UnknownBases, self).test() + + +# Test that we are detecting proper super errors. + +class BaseClass(object): + + not_a_method = 42 + + def function(self, param): + return param + self.not_a_method + + def __getattr__(self, attr): + return attr + + +class InvalidSuperChecks(BaseClass): + + def __init__(self): + super(InvalidSuperChecks, self).not_a_method() # [not-callable] + super(InvalidSuperChecks, self).attribute_error() # [no-member] + super(InvalidSuperChecks, self).function(42) + super(InvalidSuperChecks, self).function() # [no-value-for-parameter] + super(InvalidSuperChecks, self).function(42, 24, 24) # [too-many-function-args] + # +1: [unexpected-keyword-arg,no-value-for-parameter] + super(InvalidSuperChecks, self).function(lala=42) + # Even though BaseClass has a __getattr__, that won't + # be called. + super(InvalidSuperChecks, self).attribute_error() # [no-member] |