[issue2100] unit test UnicodeWarning

Joseph Armbruster report at bugs.python.org
Wed Feb 13 15:21:04 CET 2008


New submission from Joseph Armbruster:

I receive the following warning when running the test_unicode_file unit
tests out of the trunk (60758)

python  -E -tt ../../lib/test/regrtest.py -g "test_unicode_file"
test_unicode_file
D:\work\pytrunk\lib\test\test_unicode_file.py:103: UnicodeWarning:
Unicode equal comparison failed to convert both arguments to Unicode -
interpreting them as being unequal
  filename1==filename2
D:\work\pytrunk\lib\shutil.py:36: UnicodeWarning: Unicode equal
comparison failed to convert both arguments to Unicode - interpreting
them as being unequal
  os.path.normcase(os.path.abspath(dst)))
1 test OK.

It looks like the warning was meant to be suppressed in
test_unicode_file.py line 104:

# Try using shutil on the filenames.
try:
    filename1==filename2
except UnicodeDecodeError:
    # these filenames can't be compared - shutil.copy tries to do
    # just that.  This is really a bug in 'shutil' - if one of shutil's
    # 2 params are Unicode and the other isn't, it should coerce the
    # string to Unicode with the filesystem encoding before comparison.
    pass


This does not handle the UnicodeWarning, was it meant to?

----------
components: Tests
messages: 62358
nosy: JosephArmbruster
severity: normal
status: open
title: unit test UnicodeWarning
type: behavior
versions: Python 2.6

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2100>
__________________________________


More information about the Python-bugs-list mailing list