Closed
Description
Given the following test code:
def test_foobar(self):
class Foo(object):
name = u'é'
def __repr__(self):
return self.name.encode('utf8')
foo = Foo()
assert not foo
Running it gives
Traceback (most recent call last):
File "/Users/mathieu/olympia/apps/addons/tests/test_models.py", line 529, in test_foobar
assert not foo
File "/Users/mathieu/.virtualenvs/olympia/lib/python2.7/site-packages/_pytest/assertion/util.py", line 33, in format_explanation
return u('\n').join(result)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 11: ordinal not in range(128)
result
is ['assert not \xc3\xa9']
. I believe that python's default encoding used to decode from str to unicode is ascii
, which fails while decoding the utf-8 encoded object representation.
Metadata
Metadata
Assignees
Labels
No labels