[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:
@@ -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")
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user