File: pure_mode_cmethod_inheritance_T583.py

package info (click to toggle)
cython 3.0.11%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 19,092 kB
  • sloc: python: 83,539; ansic: 18,831; cpp: 1,402; xml: 1,031; javascript: 511; makefile: 403; sh: 204; sed: 11
file content (74 lines) | stat: -rw-r--r-- 1,475 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
class Base(object):
    '''
    >>> base = Base()
    >>> print(base.noargs())
    Base
    >>> print(base.int_arg(1))
    Base
    >>> print(base._class())
    Base
    '''
    def noargs(self):
        return "Base"
    def int_arg(self, i):
        return "Base"
    @classmethod
    def _class(tp):
        return "Base"


class Derived(Base):
    '''
    >>> derived = Derived()
    >>> print(derived.noargs())
    Derived
    >>> print(derived.int_arg(1))
    Derived
    >>> print(derived._class())
    Derived
    '''
    def noargs(self):
        return "Derived"
    def int_arg(self, i):
        return "Derived"
    @classmethod
    def _class(tp):
        return "Derived"


class DerivedDerived(Derived):
    '''
    >>> derived = DerivedDerived()
    >>> print(derived.noargs())
    DerivedDerived
    >>> print(derived.int_arg(1))
    DerivedDerived
    >>> print(derived._class())
    DerivedDerived
    '''
    def noargs(self):
        return "DerivedDerived"
    def int_arg(self, i):
        return "DerivedDerived"
    @classmethod
    def _class(tp):
        return "DerivedDerived"


class Derived2(Base):
    '''
    >>> derived = Derived2()
    >>> print(derived.noargs())
    Derived2
    >>> print(derived.int_arg(1))
    Derived2
    >>> print(derived._class())
    Derived2
    '''
    def noargs(self):
        return "Derived2"
    def int_arg(self, i):
        return "Derived2"
    @classmethod
    def _class(tp):
        return "Derived2"