[svn r57535] extending hacks for a safe representation of objects

to also work for broken __repr__s on newstyle classes.

--HG--
branch : trunk
This commit is contained in:
hpk
2008-08-21 11:48:46 +02:00
parent d5e61e470d
commit 5f666c99b7
3 changed files with 19 additions and 2 deletions

View File

@@ -35,5 +35,14 @@ def test_big_repr():
assert len(safe_repr._repr(range(1000))) <= \
len('[' + safe_repr.SafeRepr().maxlist * "1000" + ']')
def test_repr_on_newstyle():
class Function(object):
def __repr__(self):
return "<%s>" %(self.name)
try:
s = safe_repr._repr(Function())
except Exception, e:
py.test.fail("saferepr failed for newstyle class")