mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Added more tests for urllib.parse utility functions.
These functions are not documented but used in third-party code.
This commit is contained in:
parent
ed0392ae06
commit
9270be7662
2 changed files with 129 additions and 69 deletions
|
@ -1294,21 +1294,6 @@ class Pathname_Tests(unittest.TestCase):
|
|||
class Utility_Tests(unittest.TestCase):
|
||||
"""Testcase to test the various utility functions in the urllib."""
|
||||
|
||||
def test_splitpasswd(self):
|
||||
"""Some of password examples are not sensible, but it is added to
|
||||
confirming to RFC2617 and addressing issue4675.
|
||||
"""
|
||||
self.assertEqual(('user', 'ab'),urllib.parse.splitpasswd('user:ab'))
|
||||
self.assertEqual(('user', 'a\nb'),urllib.parse.splitpasswd('user:a\nb'))
|
||||
self.assertEqual(('user', 'a\tb'),urllib.parse.splitpasswd('user:a\tb'))
|
||||
self.assertEqual(('user', 'a\rb'),urllib.parse.splitpasswd('user:a\rb'))
|
||||
self.assertEqual(('user', 'a\fb'),urllib.parse.splitpasswd('user:a\fb'))
|
||||
self.assertEqual(('user', 'a\vb'),urllib.parse.splitpasswd('user:a\vb'))
|
||||
self.assertEqual(('user', 'a:b'),urllib.parse.splitpasswd('user:a:b'))
|
||||
self.assertEqual(('user', 'a b'),urllib.parse.splitpasswd('user:a b'))
|
||||
self.assertEqual(('user 2', 'ab'),urllib.parse.splitpasswd('user 2:ab'))
|
||||
self.assertEqual(('user+1', 'a+b'),urllib.parse.splitpasswd('user+1:a+b'))
|
||||
|
||||
def test_thishost(self):
|
||||
"""Test the urllib.request.thishost utility function returns a tuple"""
|
||||
self.assertIsInstance(urllib.request.thishost(), tuple)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue