[svn r57321] merging the event branch:

* moving in test, misc, code, io directories and
  py/__init__.py
* py/bin/_find.py does not print to stderr anymore
* a few fixes to conftest files in other dirs
some more fixes and adjustments pending

--HG--
branch : trunk
This commit is contained in:
hpk
2008-08-16 17:26:59 +02:00
parent 7428eadf7d
commit abc8cf09aa
187 changed files with 27242 additions and 18 deletions

View File

@@ -0,0 +1,34 @@
import py
from py.__.code import safe_repr
def test_simple_repr():
assert safe_repr._repr(1) == '1'
assert safe_repr._repr(None) == 'None'
class BrokenRepr:
def __init__(self, ex):
self.ex = ex
foo = 0
def __repr__(self):
raise self.ex
def test_exception():
assert 'Exception' in safe_repr._repr(BrokenRepr(Exception("broken")))
class BrokenReprException(Exception):
__str__ = None
__repr__ = None
def test_broken_exception():
assert 'Exception' in safe_repr._repr(BrokenRepr(BrokenReprException("really broken")))
def test_string_exception():
assert 'unknown' in safe_repr._repr(BrokenRepr("string"))
def test_big_repr():
assert len(safe_repr._repr(range(1000))) <= \
len('[' + safe_repr.SafeRepr().maxlist * "1000" + ']')