summaryrefslogtreecommitdiff
path: root/tests/functional/n
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-03-16 22:53:17 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-03-17 21:14:30 +0100
commit11424700c42f235fd6bdcc8353f82a9d39960dd0 (patch)
tree877764ce342603686f66810fd1c36c6ebbadfc89 /tests/functional/n
parentcb5d9414913b6a7ade270b965c050c43a223633a (diff)
downloadpylint-git-11424700c42f235fd6bdcc8353f82a9d39960dd0.tar.gz
Rename func_w0233 to non_init_parent_called
Diffstat (limited to 'tests/functional/n')
-rw-r--r--tests/functional/n/non_init_parent_called.py51
-rw-r--r--tests/functional/n/non_init_parent_called.txt6
2 files changed, 57 insertions, 0 deletions
diff --git a/tests/functional/n/non_init_parent_called.py b/tests/functional/n/non_init_parent_called.py
new file mode 100644
index 000000000..fd196f666
--- /dev/null
+++ b/tests/functional/n/non_init_parent_called.py
@@ -0,0 +1,51 @@
+# pylint: disable=R0903,W0212,W0406,no-absolute-import,wrong-import-order, useless-object-inheritance,line-too-long
+
+"""test for call to __init__ from a non ancestor class
+"""
+from __future__ import print_function
+from . import non_init_parent_called
+import nonexistant # [import-error]
+__revision__ = '$Id: non_init_parent_called.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, non_init_parent_called.AAAA, non_init_parent_called.BBBB, nonexistant.AClass): # [no-member]
+ """mix different things, some inferable some not"""
+ def __init__(self):
+ BBBBMixin.__init__(self)
+ non_init_parent_called.AAAA.__init__(self)
+ non_init_parent_called.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/n/non_init_parent_called.txt b/tests/functional/n/non_init_parent_called.txt
new file mode 100644
index 000000000..2dc98a361
--- /dev/null
+++ b/tests/functional/n/non_init_parent_called.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:50:CCC:Module 'functional.n.non_init_parent_called' has no 'BBBB' member:INFERENCE
+no-member:28:8:CCC.__init__:Module 'functional.n.non_init_parent_called' 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