| 55 | |
| 56 | @pytest.mark.xfail("env.PYPY") |
| 57 | def test_multiple_inheritance_python(): |
| 58 | class MI1(m.Base1, m.Base2): |
| 59 | def __init__(self, i, j): |
| 60 | m.Base1.__init__(self, i) |
| 61 | m.Base2.__init__(self, j) |
| 62 | |
| 63 | class B1: |
| 64 | def v(self): |
| 65 | return 1 |
| 66 | |
| 67 | class MI2(B1, m.Base1, m.Base2): |
| 68 | def __init__(self, i, j): |
| 69 | B1.__init__(self) |
| 70 | m.Base1.__init__(self, i) |
| 71 | m.Base2.__init__(self, j) |
| 72 | |
| 73 | class MI3(MI2): |
| 74 | def __init__(self, i, j): |
| 75 | MI2.__init__(self, i, j) |
| 76 | |
| 77 | class MI4(MI3, m.Base2): |
| 78 | def __init__(self, i, j): |
| 79 | MI3.__init__(self, i, j) |
| 80 | # This should be ignored (Base2 is already initialized via MI2): |
| 81 | m.Base2.__init__(self, i + 100) |
| 82 | |
| 83 | class MI5(m.Base2, B1, m.Base1): |
| 84 | def __init__(self, i, j): |
| 85 | B1.__init__(self) |
| 86 | m.Base1.__init__(self, i) |
| 87 | m.Base2.__init__(self, j) |
| 88 | |
| 89 | class MI6(m.Base2, B1): |
| 90 | def __init__(self, i): |
| 91 | m.Base2.__init__(self, i) |
| 92 | B1.__init__(self) |
| 93 | |
| 94 | class B2(B1): |
| 95 | def v(self): |
| 96 | return 2 |
| 97 | |
| 98 | class B3: |
| 99 | def v(self): |
| 100 | return 3 |
| 101 | |
| 102 | class B4(B3, B2): |
| 103 | def v(self): |
| 104 | return 4 |
| 105 | |
| 106 | class MI7(B4, MI6): |
| 107 | def __init__(self, i): |
| 108 | B4.__init__(self) |
| 109 | MI6.__init__(self, i) |
| 110 | |
| 111 | class MI8(MI6, B3): |
| 112 | def __init__(self, i): |
| 113 | MI6.__init__(self, i) |
| 114 | B3.__init__(self) |