New submission from Michael Foord <mich...@voidspace.org.uk>:

>>> import unittest
>>> class Foo(unittest.TestCase):
...   def test_fffd(self): self.assertEqual(u'\ufffd', u'\ufffd\ufffd')
...
>>> unittest.main(exit=False)
F
======================================================================
FAIL: test_fffd (__main__.Foo)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "<stdin>", line 2, in test_fffd
AssertionError: <unprintable AssertionError object>

----------------------------------------------------------------------
Ran 1 test in 0.001s


The problem with creating unicode tracebacks is that they could fail when being 
output on terminals not capable of showing the full range of unicode characters 
(the default terminal on Windows is CP1252).

This can already happen with Unicode messages that aren't part of the traceback.

Detecting the 'unprintable' message before calling into traceback and replacing 
it with the repr of the unicode is one possibility.

----------
assignee: michael.foord
components: Library (Lib)
messages: 102368
nosy: ezio.melotti, michael.foord
severity: normal
status: open
title: <unprintable AssertionError object> message in unittest tracebacks
type: behavior
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8313>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to