test_nonascii: two unicode a's (was: Re: win32 selftest results)

Alexander Belchenko bialix at ukr.net
Sun Jul 2 12:20:05 BST 2006


Alexander Belchenko пишет:
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File 
> "E:\work\MyCode\bzr\devel\jam.win32\bzrlib\tests\test_nonascii.py", line 
> 80, in test_platform
>     self.assertEqual(expected, present)
> AssertionError: [u'\xe4', u'\xe5', u'\u017d'] != [u'\xe4', u'\u017d']


I'm very surprised why another test is passed: 
test_nonascii.UnicodeFilename.test_access

I'm run selftest with --keep-output to look into test directories. And 
this is *funniest* thing ever! In directory actually 2 files instead of 
3. And test_access *passing*. Yes-yes-yes: it passing.

So I run python interpreter in this directory and saw this:

 >>> import os
 >>> os.getcwd()
'E:\\work\\MyCode\\bzr\\devel\\jam.win32\\test0000.tmp\\test_nonascii.UnicodeFilename.test_access'
 >>> os.listdir('.')
['a', 'Z']
 >>> os.listdir(u'.')
[u'\xe4', u'\u017d']
 >>> file(u'\xe4').read()
'contents of \xc3\xa4\n'
 >>> file(u'\xe5').read()
'contents of \xc3\xa4\n'

It's looks like Windows or Python convert unicode filenames to plain 
string form and then back. I don't understand how and why. I never seen 
this before.

One note: both this unicode a (with dots and with circle) cannot be 
represented in russian character set. So maybe here is root of problem?

Can be this problem related for other failed unicode_paths tests?

--
Alexander





More information about the bazaar mailing list