This test should be run only if support for reverse ops is enabled, so the corresponding feature_check is added to run-tests.crypto-aes
parent
eb84a830df
commit
d6f9d64d97
@ -0,0 +1,18 @@
|
||||
class A:
|
||||
|
||||
def __init__(self, v):
|
||||
self.v = v
|
||||
|
||||
def __add__(self, o):
|
||||
if isinstance(o, A):
|
||||
return A(self.v + o.v)
|
||||
return A(self.v + o)
|
||||
|
||||
def __radd__(self, o):
|
||||
return A(self.v + o)
|
||||
|
||||
def __repr__(self):
|
||||
return "A(%s)" % self.v
|
||||
|
||||
print(A(3) + 1)
|
||||
print(2 + A(5))
|
@ -0,0 +1,9 @@
|
||||
class Foo:
|
||||
|
||||
def __radd__(self, other):
|
||||
pass
|
||||
|
||||
try:
|
||||
5 + Foo()
|
||||
except TypeError:
|
||||
print("TypeError")
|
Loading…
Reference in new issue