diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2011-04-14 05:16:30 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2011-04-14 05:16:30 (GMT) |
commit | 2d2ea1b431f9cf58aa8ac45052bd2e4cf2502a5c (patch) | |
tree | 4a476efc06de2f3beb77b85e37068dc20995c40c /Lib/test/test_urllib.py | |
parent | 95cd91c17f4c3ce5eab27551150f5e92ecb1bc22 (diff) | |
download | cpython-2d2ea1b431f9cf58aa8ac45052bd2e4cf2502a5c.zip cpython-2d2ea1b431f9cf58aa8ac45052bd2e4cf2502a5c.tar.gz cpython-2d2ea1b431f9cf58aa8ac45052bd2e4cf2502a5c.tar.bz2 |
Fix Issue11474 - fix url2pathname() handling of '/C|/' on Windows
Diffstat (limited to 'Lib/test/test_urllib.py')
-rw-r--r-- | Lib/test/test_urllib.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index 462a2b0..4d3509a 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -9,6 +9,7 @@ import io import unittest from test import support import os +import sys import tempfile import warnings @@ -995,6 +996,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.""" |