diff options
| author | R David Murray <rdmurray@bitdance.com> | 2015-05-18 00:44:50 (GMT) |
|---|---|---|
| committer | R David Murray <rdmurray@bitdance.com> | 2015-05-18 00:44:50 (GMT) |
| commit | c17686f071c6f5b5d20366ae32188327a36e282e (patch) | |
| tree | 70c6482b2a224313d4771917aff6f9b810e00fb8 /Lib/test | |
| parent | 1dbee9460e6a242bfbdd701ce328f11f7dd69019 (diff) | |
| download | cpython-c17686f071c6f5b5d20366ae32188327a36e282e.zip cpython-c17686f071c6f5b5d20366ae32188327a36e282e.tar.gz cpython-c17686f071c6f5b5d20366ae32188327a36e282e.tar.bz2 | |
Issue #13866: add *quote_via* argument to urlencode.
Patch by samwyse, completed by Arnon Yaari, and reviewed by
Martin Panter.
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_urlparse.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py index 156ccf5..4fa3dc6 100644 --- a/Lib/test/test_urlparse.py +++ b/Lib/test/test_urlparse.py @@ -785,6 +785,16 @@ class UrlParseTestCase(unittest.TestCase): result = urllib.parse.urlencode({'a': Trivial()}, True) self.assertEqual(result, 'a=trivial') + def test_urlencode_quote_via(self): + result = urllib.parse.urlencode({'a': 'some value'}) + self.assertEqual(result, "a=some+value") + result = urllib.parse.urlencode({'a': 'some value/another'}, + quote_via=urllib.parse.quote) + self.assertEqual(result, "a=some%20value%2Fanother") + result = urllib.parse.urlencode({'a': 'some value/another'}, + safe='/', quote_via=urllib.parse.quote) + self.assertEqual(result, "a=some%20value/another") + def test_quote_from_bytes(self): self.assertRaises(TypeError, urllib.parse.quote_from_bytes, 'foo') result = urllib.parse.quote_from_bytes(b'archaeological arcana') |
