Statistics
| Revision:

gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / pylint / test / functional / init_not_called.py @ 745

History | View | Annotate | Download (1.41 KB)

1
# pylint: disable=R0903,import-error,missing-docstring,wrong-import-position
2
"""test for __init__ not called
3
"""
4
from __future__ import print_function
5

    
6
class AAAA:  # <3.0:[old-style-class]
7
    """ancestor 1"""
8

    
9
    def __init__(self):
10
        print('init', self)
11

    
12
class BBBB:  # <3.0:[old-style-class]
13
    """ancestor 2"""
14

    
15
    def __init__(self):
16
        print('init', self)
17

    
18
class CCCC:  # <3.0:[old-style-class,no-init]
19
    """ancestor 3"""
20

    
21

    
22
class ZZZZ(AAAA, BBBB, CCCC):
23
    """derived class"""
24

    
25
    def __init__(self):  # [super-init-not-called]
26
        AAAA.__init__(self)
27

    
28
class NewStyleA(object):
29
    """new style class"""
30
    def __init__(self):
31
        super(NewStyleA, self).__init__()
32
        print('init', self)
33

    
34
class NewStyleB(NewStyleA):
35
    """derived new style class"""
36
    def __init__(self):
37
        super(NewStyleB, self).__init__()
38

    
39
class NoInit(object):
40
    """No __init__ defined"""
41

    
42
class Init(NoInit):
43
    """Don't complain for not calling the super __init__"""
44

    
45
    def __init__(self, arg):
46
        self.arg = arg
47

    
48
class NewStyleC(object):
49
    """__init__ defined by assignemnt."""
50
    def xx_init(self):
51
        """Initializer."""
52
        pass
53

    
54
    __init__ = xx_init
55

    
56
class AssignedInit(NewStyleC):
57
    """No init called."""
58
    def __init__(self):  # [super-init-not-called]
59
        self.arg = 0
60

    
61
from missing import Missing
62

    
63
class UnknownBases(Missing):
64
    """Don't emit no-init if the bases aren't known."""