summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_repr.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-04-20 16:07:39 (GMT)
committerGuido van Rossum <guido@python.org>2006-04-20 16:07:39 (GMT)
commita48a3b42dd78c0201010ed737fdc45244a526648 (patch)
treed8c38fb35040a77102f969e15a157d5aa315ec6f /Lib/test/test_repr.py
parent08a1a9fac7d754207ac339e1828a789d0462dfd4 (diff)
downloadcpython-a48a3b42dd78c0201010ed737fdc45244a526648.zip
cpython-a48a3b42dd78c0201010ed737fdc45244a526648.tar.gz
cpython-a48a3b42dd78c0201010ed737fdc45244a526648.tar.bz2
Fix test failures for repr.py.
But shouldn't we kill this module? How many pprint clones do we need?
Diffstat (limited to 'Lib/test/test_repr.py')
-rw-r--r--Lib/test/test_repr.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/test/test_repr.py b/Lib/test/test_repr.py
index 4ded484..9128585 100644
--- a/Lib/test/test_repr.py
+++ b/Lib/test/test_repr.py
@@ -111,7 +111,7 @@ class ReprTests(unittest.TestCase):
s = r(ClassWithFailingRepr)
self.failUnless(s.startswith("<class "))
self.failUnless(s.endswith(">"))
- self.failUnless(s.find("...") == 8)
+ self.failUnless(s.find("...") in [12, 13])
def test_file(self):
fp = open(unittest.__file__)
@@ -249,8 +249,7 @@ class bar:
''')
from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import bar
# Module name may be prefixed with "test.", depending on how run.
- self.failUnless(repr(bar.bar).startswith(
- "<class %s.bar at 0x" % bar.__name__))
+ self.assertEquals(repr(bar.bar), "<class '%s.bar'>" % bar.__name__)
def test_instance(self):
touch(os.path.join(self.subpkgname, 'baz'+os.extsep+'py'), '''\
@@ -260,7 +259,7 @@ class baz:
from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import baz
ibaz = baz.baz()
self.failUnless(repr(ibaz).startswith(
- "<%s.baz instance at 0x" % baz.__name__))
+ "<%s.baz object at 0x" % baz.__name__))
def test_method(self):
eq = self.assertEquals
@@ -275,7 +274,7 @@ class aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# Bound method next
iqux = qux.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
self.failUnless(repr(iqux.amethod).startswith(
- '<bound method aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.amethod of <%s.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa instance at 0x' \
+ '<bound method aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.amethod of <%s.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa object at 0x' \
% (qux.__name__,) ))
def test_builtin_function(self):
@@ -286,7 +285,7 @@ class ClassWithRepr:
def __init__(self, s):
self.s = s
def __repr__(self):
- return "ClassWithLongRepr(%r)" % self.s
+ return "ClassWithRepr(%r)" % self.s
class ClassWithFailingRepr: