[pypy-svn] r26474 - in pypy/dist/pypy/rpython/ootypesystem: . test
nik at codespeak.net
nik at codespeak.net
Fri Apr 28 03:50:51 CEST 2006
Author: nik
Date: Fri Apr 28 03:50:47 2006
New Revision: 26474
Modified:
pypy/dist/pypy/rpython/ootypesystem/ootype.py
pypy/dist/pypy/rpython/ootypesystem/test/test_oodict.py
Log:
make str and hash of recursive Dict types work.
Modified: pypy/dist/pypy/rpython/ootypesystem/ootype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/ootype.py (original)
+++ pypy/dist/pypy/rpython/ootypesystem/ootype.py Fri Apr 28 03:50:47 2006
@@ -387,8 +387,8 @@
# equal.
def __str__(self):
- return '%s%s' % (self.__class__.__name__,
- saferecursive(str, "(...)")((self._KEYTYPE, self._VALUETYPE)))
+ return '%s(%s, %s)' % (self.__class__.__name__,
+ self._KEYTYPE, saferecursive(str, "...")(self._VALUETYPE))
def __eq__(self, other):
if not isinstance(other, Dict):
Modified: pypy/dist/pypy/rpython/ootypesystem/test/test_oodict.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/test/test_oodict.py (original)
+++ pypy/dist/pypy/rpython/ootypesystem/test/test_oodict.py Fri Apr 28 03:50:47 2006
@@ -43,3 +43,9 @@
assert DT2 == DT
assert hash(DT) == hash(DT2)
+def test_recursive_str_hash():
+ DT = Dict(Signed)
+ setValueType(DT, DT)
+ assert isinstance(str(DT), str)
+ assert isinstance(hash(DT), int)
+
More information about the Pypy-commit
mailing list