This commit is contained in:
Miroslav 2018-01-14 13:41:15 +02:00
parent 68c32d8627
commit 267b1af835
2 changed files with 2 additions and 1 deletions

View File

@ -78,7 +78,7 @@ def encode(s: Sequence[Tuple[str, str]], similar_to: str=None) -> str:
if remove_trailing_equal:
encoded = encoded.replace("=&", "&")
if encoded[-1] == '=':
if encoded and encoded[-1] == '=':
encoded = encoded[:-1]
return encoded

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():