You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2010-10-24.21:05:33.001>created_at=<Date2010-10-21.00:14:03.526>labels= ['library', 'expert-unicode']
title='unittest: use ascii() instead of repr() to display values on error'updated_at=<Date2010-10-25.01:11:34.284>user='https://github.com/vstinner'
Traceback (most recent call last):
File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_pep277.py", line 157, in test_listdirself.assertEqual(sf0, sf2)
AssertionError: Items in the first set but not the second:
'@test_18608_tmp/ ̈�Υ�Ϋ'
'@test_18608_tmp/ẛ῁῍᾿�῏῝῾�῟῭'
Items in the second set but not the first:
'@test_18608_tmp/ ̈�ΥΥ�̈'
'@test_18608_tmp/ẛ῁῍᾿�᾿῾῾῾῁̀�͂̀'
'@test_18608_tmp/¨�ϒϒ�̈'
This is a test on unicode filenames. I would prefer to see non-ASCII characters as \xHH or \uXXXX than strange characters or boxes.
Do you think that it is a good idea to replace calls to repr() by ascii() in the unittest library?
In Python2, repr(unicode) escapes all non-ASCII characters. But in Python3, only control characters and surrogates are escaped. So the output depends on the terminal encoding.
Write non-ASCII characters in a backtrace may also raise a new error if the terminal is unable to a character. Raise an error while printing an error is just horrible :-)
--
Attached patch is a try to replace repr() by ascii() in the unittest module. But I don't know this library, so don't trust the patch :-)
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: