Tweak the fix for test_traceback since the fix for it to run on its own broke

it under regrtest.  'traceback' likes to strip out the module name if it is
__main__ or __builtin__ but not in other cases.
This commit is contained in:
Brett Cannon 2007-02-27 00:12:43 +00:00
parent dfb2a8a7c1
commit 44c526174d
1 changed files with 5 additions and 1 deletions

View File

@ -118,7 +118,11 @@ def test():
err = traceback.format_exception_only(X, X())
self.assertEqual(len(err), 1)
str_value = '<unprintable %s object>' % X.__name__
self.assertEqual(err[0], "%s: %s\n" % ( X.__name__, str_value))
if X.__module__ in ('__main__', '__builtin__'):
str_name = X.__name__
else:
str_name = '.'.join([X.__module__, X.__name__])
self.assertEqual(err[0], "%s: %s\n" % (str_name, str_value))
def test_without_exception(self):
err = traceback.format_exception_only(None, None)