summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-08-09 16:11:37 (GMT)
committerGuido van Rossum <guido@python.org>2002-08-09 16:11:37 (GMT)
commit0f5f0b8057e3a1368d6e3b340173ae2c5d95cac5 (patch)
tree702fa48827bda02a4bd238446a68108766103246 /Lib/test/test_descr.py
parentd81a9834f76daaf3bc689da64c8e9514eae46e48 (diff)
downloadcpython-0f5f0b8057e3a1368d6e3b340173ae2c5d95cac5.zip
cpython-0f5f0b8057e3a1368d6e3b340173ae2c5d95cac5.tar.gz
cpython-0f5f0b8057e3a1368d6e3b340173ae2c5d95cac5.tar.bz2
Test for Neil's fix to correctly invoke __rmul__.
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r--Lib/test/test_descr.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 94dba1a..51fa0d9 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -3232,6 +3232,21 @@ def slottrash():
o = trash(o)
del o
+def testrmul():
+ # SF patch 592646
+ if verbose:
+ print "Testing correct invocation of __rmul__..."
+ class C(object):
+ def __mul__(self, other):
+ return "mul"
+ def __rmul__(self, other):
+ return "rmul"
+ a = C()
+ vereq(a*2, "mul")
+ vereq(a*2.2, "mul")
+ vereq(2*a, "rmul")
+ vereq(2.2*a, "rmul")
+
def do_this_first():
if verbose:
print "Testing SF bug 551412 ..."
@@ -3324,6 +3339,7 @@ def test_main():
slices()
subtype_resurrection()
slottrash()
+ testrmul()
if verbose: print "All OK"
if __name__ == "__main__":