[pypy-commit] pypy py3k: __hex__ and __oct__ has gone in py3k, and we can return only str from __str__ and __repr__ (instead of e.g. str and unicode in py2). Adapt this test, which is now very simple
antocuni
noreply at buildbot.pypy.org
Tue Feb 28 23:43:49 CET 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r53005:49869aab11b9
Date: 2012-02-28 23:28 +0100
http://bitbucket.org/pypy/pypy/changeset/49869aab11b9/
Log: __hex__ and __oct__ has gone in py3k, and we can return only str
from __str__ and __repr__ (instead of e.g. str and unicode in py2).
Adapt this test, which is now very simple
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
@@ -280,17 +280,10 @@
return answer * 2
def __repr__(self):
return answer * 3
- def __hex__(self):
- return answer * 4
- def __oct__(self):
- return answer * 5
- for operate, n in [(str, 2), (repr, 3), (hex, 4), (oct, 5)]:
+ for operate, n in [(str, 2), (repr, 3)]:
answer = "hello"
assert operate(A()) == "hello" * n
- if operate not in (hex, oct):
- answer = u"world"
- assert operate(A()) == "world" * n
assert type(operate(A())) is str
answer = 42
raises(TypeError, operate, A())
More information about the pypy-commit
mailing list