summaryrefslogtreecommitdiff
path: root/Lib/test/test_repr.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-09-05 02:26:26 +0000
committerGuido van Rossum <guido@python.org>2001-09-05 02:26:26 +0000
commit19cb7a0e8493a3fec4694127429edec4f6616b8c (patch)
treec6b74551bbddcb22b4066c5ed6082fb06d92b75d /Lib/test/test_repr.py
parent12d8c659e5726879ec2bb80c4d2a9329c3848185 (diff)
downloadcpython-19cb7a0e8493a3fec4694127429edec4f6616b8c.tar.gz
Add a test for the final branch in repr.Repr.repr1(), which deals with
a default repr() that's longer than 20 characters.
Diffstat (limited to 'Lib/test/test_repr.py')
-rw-r--r--Lib/test/test_repr.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_repr.py b/Lib/test/test_repr.py
index 1281b1f276..c23fe77135 100644
--- a/Lib/test/test_repr.py
+++ b/Lib/test/test_repr.py
@@ -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(