Add a test for the final branch in repr.Repr.repr1(), which deals with

a default repr() that's longer than 20 characters.
This commit is contained in:
Guido van Rossum 2001-09-05 02:26:26 +00:00
parent 785261684e
commit cf856f9f28
1 changed files with 5 additions and 0 deletions

View File

@ -78,6 +78,11 @@ class ReprTests(unittest.TestCase):
i3 = ClassWithFailingRepr()
eq(r(i3), ("<ClassWithFailingRepr instance at %x>"%id(i3)))
s = r(ClassWithFailingRepr)
self.failUnless(s.startswith("<class "))
self.failUnless(s.endswith(">"))
self.failUnless(s.find("...") == 8)
def test_file(self):
fp = open(unittest.__file__)
self.failUnless(repr(fp).startswith(