merge from 3.2.

Fix closes Issue1147.
This commit is contained in:
Senthil Kumaran 2011-04-14 13:20:41 +08:00
commit 99e97f92c6
3 changed files with 25 additions and 1 deletions

View file

@ -9,6 +9,7 @@ import io
import unittest
from test import support
import os
import sys
import tempfile
def hexescape(char):
@ -1021,6 +1022,23 @@ class Pathname_Tests(unittest.TestCase):
"url2pathname() failed; %s != %s" %
(expect, result))
@unittest.skipUnless(sys.platform == 'win32',
'test specific to the urllib.url2path function.')
def test_ntpath(self):
given = ('/C:/', '///C:/', '/C|//')
expect = 'C:\\'
for url in given:
result = urllib.request.url2pathname(url)
self.assertEqual(expect, result,
'urllib.request..url2pathname() failed; %s != %s' %
(expect, result))
given = '///C|/path'
expect = 'C:\\path'
result = urllib.request.url2pathname(given)
self.assertEqual(expect, result,
'urllib.request.url2pathname() failed; %s != %s' %
(expect, result))
class Utility_Tests(unittest.TestCase):
"""Testcase to test the various utility functions in the urllib."""