[issue33709] test.support.FS_NONASCII returns incorrect result in Windows with non-US locale

Ivan Pozdeev report at bugs.python.org
Thu May 31 04:54:10 EDT 2018


New submission from Ivan Pozdeev <ivan_pozdeev at mail.ru>:

This causes test_ntpath and test_posixpath to fail in subj.

Sample failure:

======================================================================
FAIL: test_expandvars_nonascii (__main__.NtCommonTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\Users\Sasha\Documents\cpython\lib\test\test_genericpath.py", line 230
, in test_expandvars_nonascii
    check(u'$spam bar', u'%s bar' % unonascii)
  File "c:\Users\Sasha\Documents\cpython\lib\test\test_genericpath.py", line 214
, in check
    self.assertEqual(expandvars(value), expected)
AssertionError: u'? bar' != u'\xe6 bar'
- ? bar
? ^
+ \xe6 bar
? ^


Cause:

if sys.getfilesystemencoding()=='mbcs', encoding Unicode characters that are missing in the current locale succeeds but produces '?'.

So, test.support.FS_NONASCII's test fails to detect if a character is present in the current locale.

----------
components: Tests
messages: 318271
nosy: Ivan.Pozdeev
priority: normal
severity: normal
status: open
title: test.support.FS_NONASCII returns incorrect result in Windows with non-US locale
type: behavior
versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33709>
_______________________________________


More information about the Python-bugs-list mailing list