Merge pull request #2793 from kajojify/issue-2399

Issue 2399
This commit is contained in:
Maximilian Hils 2018-01-14 21:52:32 +01:00 committed by GitHub
commit 9a43ff5da1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -76,7 +76,7 @@ def encode(s: Sequence[Tuple[str, str]], similar_to: str=None) -> str:
encoded = urllib.parse.urlencode(s, False, errors="surrogateescape")
if remove_trailing_equal:
if encoded and remove_trailing_equal:
encoded = encoded.replace("=&", "&")
if encoded[-1] == '=':
encoded = encoded[:-1]

View file

@ -108,6 +108,7 @@ def test_empty_key_trailing_equal_sign():
def test_encode():
assert url.encode([('foo', 'bar')])
assert url.encode([('foo', surrogates)])
assert not url.encode([], similar_to="justatext")
def test_decode():