diff options
Diffstat (limited to 'pylint/test/functional/init_not_called.py')
-rw-r--r-- | pylint/test/functional/init_not_called.py | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/pylint/test/functional/init_not_called.py b/pylint/test/functional/init_not_called.py new file mode 100644 index 0000000..e22be39 --- /dev/null +++ b/pylint/test/functional/init_not_called.py @@ -0,0 +1,59 @@ +# pylint: disable=R0903 +"""test for __init__ not called +""" +from __future__ import print_function + +class AAAA: # <3.0:[old-style-class] + """ancestor 1""" + + def __init__(self): + print('init', self) + +class BBBB: # <3.0:[old-style-class] + """ancestor 2""" + + def __init__(self): + print('init', self) + +class CCCC: # <3.0:[old-style-class,no-init] + """ancestor 3""" + + +class ZZZZ(AAAA, BBBB, CCCC): + """derived class""" + + def __init__(self): # [super-init-not-called] + AAAA.__init__(self) + +class NewStyleA(object): + """new style class""" + def __init__(self): + super(NewStyleA, self).__init__() + print('init', self) + +class NewStyleB(NewStyleA): + """derived new style class""" + def __init__(self): + super(NewStyleB, self).__init__() + +class NoInit(object): + """No __init__ defined""" + +class Init(NoInit): + """Don't complain for not calling the super __init__""" + + def __init__(self, arg): + self.arg = arg + +class NewStyleC(object): + """__init__ defined by assignemnt.""" + def xx_init(self): + """Initializer.""" + pass + + __init__ = xx_init + +class AssignedInit(NewStyleC): + """No init called.""" + def __init__(self): # [super-init-not-called] + self.arg = 0 |