Debian Codegraph @

pypy/objspace/test/apptest_binop_overriding.py

raw symbols SCIP
1 def test_overriding_base_binop_explict():
2 class MulBase(object):
3 def __init__(self, value):
4 self.value = value
5 def __mul__(self, other):
6 return self.value * other.value
7 def __rmul__(self, other):
8 return other.value * self.value
9 class DoublerBase(MulBase):
10 def __mul__(self, other):
11 return 2 * (self.value * other.value)
12 class AnotherDoubler(DoublerBase):
13 pass
14 res = DoublerBase(2) * AnotherDoubler(3)
15 assert res == 12
16