Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue5827] os.path.normpath doesn't preserve unicode

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Nov 13, 2009, 5:10 PM

Post #1 of 5 (244 views)
Permalink
[issue5827] os.path.normpath doesn't preserve unicode

Ezio Melotti <ezio.melotti [at] gmail> added the comment:

Thanks for the patch, I tried it on Linux and it seems to solve the problem.

A few comments about it:
1) I'd change all the self.assertEqual(type(posixpath.normpath(u"")),
unicode) to self.assertTrue(isinstance(posixpath.normpath(u""), unicode));
2) a test for normpath(u'.') should probably be added;
3) in ntpath.py the 'slash' is actually a backslash, so the name of the
var should be changed;

----------
nosy: +ezio.melotti, kcwu, loewis, sandberg
priority: -> normal
stage: -> patch review

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5827>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 18, 2009, 4:39 PM

Post #2 of 5 (212 views)
Permalink
[issue5827] os.path.normpath doesn't preserve unicode [In reply to]

Matt Giuca <matt.giuca [at] gmail> added the comment:

Thanks Ezio.

I've updated the patch to incorporate your suggestions.

Note that I too have only tested it on Linux, but I tested both
posixpath and ntpath (and there is no OS-specific code, except for the
filenames themselves).

I'm not sure if using assertTrue(isinstance ...) is better than
assertEqual(type ...), because the type equality checking produces this
error:
AssertionError: <type 'str'> != <type 'unicode'>
while isinstance produces this unhelpful error:
AssertionError: False is not True

But oh well, I made the change anyway as most test cases use isinstance.

----------
Added file: http://bugs.python.org/file15362/normpath.2.patch

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5827>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 19, 2009, 8:42 AM

Post #3 of 5 (209 views)
Permalink
[issue5827] os.path.normpath doesn't preserve unicode [In reply to]

Ezio Melotti <ezio.melotti [at] gmail> added the comment:

assertTrue() also accepts a 'msg' argument where to explain what went
wrong in case of failure [1].

[1]:
http://docs.python.org/library/unittest.html#unittest.TestCase.assertTrue

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5827>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 19, 2009, 9:01 AM

Post #4 of 5 (209 views)
Permalink
[issue5827] os.path.normpath doesn't preserve unicode [In reply to]

Erik Carstensen <sandberg [at] virtutech> added the comment:

Also, assertTrue has an alias failUnless which I personally find more
descriptive (I don't know if either form is preferred for inclusion in
Python though).

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5827>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 19, 2009, 9:06 AM

Post #5 of 5 (210 views)
Permalink
[issue5827] os.path.normpath doesn't preserve unicode [In reply to]

Ezio Melotti <ezio.melotti [at] gmail> added the comment:

failUnless is deprecated in Python3.1 [1]. The assert* methods are
preferred over the fail* ones that are now deprecated.

[1]:
http://docs.python.org/3.1/library/unittest.html#unittest.TestCase.failUnless

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5827>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.