Author: Armin Rigo <[email protected]>
Branch: cpybug-seq-radd-rmul
Changeset: r73336:f7e76c39d341
Date: 2014-09-06 10:28 +0200
http://bitbucket.org/pypy/pypy/changeset/f7e76c39d341/
Log: passing test: the same with an old-style class
diff --git a/pypy/objspace/test/test_descroperation.py
b/pypy/objspace/test/test_descroperation.py
--- a/pypy/objspace/test/test_descroperation.py
+++ b/pypy/objspace/test/test_descroperation.py
@@ -748,6 +748,20 @@
assert 1000 * oops() == 42
assert '2'.__mul__(oops()) == '222'
+ def test_sequence_rmul_overrides_oldstyle(self):
+ class oops:
+ def __rmul__(self, other):
+ return 42
+ def __index__(self):
+ return 3
+ assert '2' * oops() == 42
+ assert [2] * oops() == 42
+ assert (2,) * oops() == 42
+ assert u'2' * oops() == 42
+ assert bytearray('2') * oops() == 42
+ assert 1000 * oops() == 42
+ assert '2'.__mul__(oops()) == '222'
+
def test_sequence_radd_overrides(self):
class A1(list):
pass
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit