From d800ae12f2efa048ee4e9c2558e646c9f3304022 Mon Sep 17 00:00:00 2001 From: Mark Hammond Date: Thu, 16 Jan 2003 04:56:52 +0000 Subject: [PATCH] This test previously failed when run from the 'test' directory. In that case, the test module created is actually a sub-package of 'test', thus the module is named 'test.areallylongpackage...' - this caused failure. Replace the hard-coded module names with __name__ attributes, which correctly reflects any hierarchy. --- Lib/test/test_repr.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_repr.py b/Lib/test/test_repr.py index 14cf181eed..47ec07c059 100644 --- a/Lib/test/test_repr.py +++ b/Lib/test/test_repr.py @@ -194,7 +194,7 @@ class LongReprTest(unittest.TestCase): touch(os.path.join(self.subpkgname, self.pkgname + os.extsep + 'py')) from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import areallylongpackageandmodulenametotestreprtruncation eq(repr(areallylongpackageandmodulenametotestreprtruncation), - "" % areallylongpackageandmodulenametotestreprtruncation.__file__) + "" % (areallylongpackageandmodulenametotestreprtruncation.__name__, areallylongpackageandmodulenametotestreprtruncation.__file__)) eq(repr(sys), "") def test_type(self): @@ -205,7 +205,7 @@ class foo(object): ''') from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import foo eq(repr(foo.foo), - "") + "" % foo.__name__) def test_object(self): # XXX Test the repr of a type with a really long tp_name but with no @@ -218,8 +218,9 @@ class bar: pass ''') from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import bar + # Module name may be prefixed with "test.", depending on how run. self.failUnless(repr(bar.bar).startswith( - "