diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-03-09 20:44:38 +0100 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-03-14 19:48:30 +0100 |
commit | c41daa7d229823e18ce6106bef85e071d6910be1 (patch) | |
tree | 0e88c9f2ea4c28415747783be708fcaef6b9fbc4 /tests/functional/d | |
parent | cd50f416aeb1f8b66f152bdbf941b7a149a5939c (diff) | |
download | pylint-git-c41daa7d229823e18ce6106bef85e071d6910be1.tar.gz |
Migrate func_dotted_ancestor.py to new functional tests
Diffstat (limited to 'tests/functional/d')
-rw-r--r-- | tests/functional/d/dotted_ancestor.py | 11 | ||||
-rw-r--r-- | tests/functional/d/dotted_ancestor.txt | 1 | ||||
-rw-r--r-- | tests/functional/d/func_w0233.py | 51 | ||||
-rw-r--r-- | tests/functional/d/func_w0233.txt | 6 |
4 files changed, 69 insertions, 0 deletions
diff --git a/tests/functional/d/dotted_ancestor.py b/tests/functional/d/dotted_ancestor.py new file mode 100644 index 000000000..3c136591e --- /dev/null +++ b/tests/functional/d/dotted_ancestor.py @@ -0,0 +1,11 @@ +"""bla""" +# pylint: disable=no-absolute-import + +from . import func_w0233 + +__revision__ = 'yo' + +class Aaaa(func_w0233.AAAA): # [too-few-public-methods] + """test dotted name in ancestors""" + def __init__(self): + func_w0233.AAAA.__init__(self) diff --git a/tests/functional/d/dotted_ancestor.txt b/tests/functional/d/dotted_ancestor.txt new file mode 100644 index 000000000..4aa47e7c2 --- /dev/null +++ b/tests/functional/d/dotted_ancestor.txt @@ -0,0 +1 @@ +too-few-public-methods:8:0:Aaaa:Too few public methods (0/2) diff --git a/tests/functional/d/func_w0233.py b/tests/functional/d/func_w0233.py new file mode 100644 index 000000000..ca0345db3 --- /dev/null +++ b/tests/functional/d/func_w0233.py @@ -0,0 +1,51 @@ +# pylint: disable=R0903,W0212,W0406,no-absolute-import,wrong-import-order, useless-object-inheritance + +"""test for call to __init__ from a non ancestor class +""" +from __future__ import print_function +from . import func_w0233 +import nonexistant # [import-error] +__revision__ = '$Id: func_w0233.py,v 1.2 2004-09-29 08:35:13 syt Exp $' + +class AAAA(object): + """ancestor 1""" + + def __init__(self): + print('init', self) + BBBBMixin.__init__(self) # [non-parent-init-called] + +class BBBBMixin(object): + """ancestor 2""" + + def __init__(self): + print('init', self) + +class CCC(BBBBMixin, func_w0233.AAAA, func_w0233.BBBB, nonexistant.AClass): # [no-member] + """mix different things, some inferable some not""" + def __init__(self): + BBBBMixin.__init__(self) + func_w0233.AAAA.__init__(self) + func_w0233.BBBB.__init__(self) # [no-member] + nonexistant.AClass.__init__(self) + +class DDDD(AAAA): + """call superclass constructor in disjunct branches""" + def __init__(self, value): + if value: + AAAA.__init__(self) + else: + AAAA.__init__(self) + +class Super(dict): + """ test late binding super() call """ + def __init__(self): + base = super() + base.__init__() + +class Super2(dict): + """ Using the same idiom as Super, but without calling + the __init__ method. + """ + def __init__(self): # [super-init-not-called] + base = super() + base.__woohoo__() # [no-member] diff --git a/tests/functional/d/func_w0233.txt b/tests/functional/d/func_w0233.txt new file mode 100644 index 000000000..a05215ae2 --- /dev/null +++ b/tests/functional/d/func_w0233.txt @@ -0,0 +1,6 @@ +import-error:7:0::Unable to import 'nonexistant' +non-parent-init-called:15:8:AAAA.__init__:__init__ method from a non direct base class 'BBBBMixin' is called +no-member:23:38:CCC:Module 'functional.d.func_w0233' has no 'BBBB' member:INFERENCE +no-member:28:8:CCC.__init__:Module 'functional.d.func_w0233' has no 'BBBB' member:INFERENCE +super-init-not-called:49:4:Super2.__init__:__init__ method from base class 'dict' is not called +no-member:51:8:Super2.__init__:Super of 'Super2' has no '__woohoo__' member:INFERENCE |