Rewrite doctest to pass on Python 2+3.

This commit is contained in:
Jason R. Coombs 2021-02-15 13:10:21 -05:00
parent ebbe645cb6
commit 2fb603e603

View File

@ -277,10 +277,11 @@ def escape_path(path):
Return path quoted to US-ASCII.
>>> path = u'/føö/bar/☃'
>>> escape_path(path)
>>> escaped = escape_path(path)
>>> str(escaped)
'/f%C3%B8%C3%B6/bar/%E2%98%83'
>>> escape_path(path).encode('ascii')
b'/f%C3%B8%C3%B6/bar/%E2%98%83'
>>> escaped.encode('ascii').decode('ascii') == escaped
True
"""
# this always returns bytes, specifically US-ASCII, valid URL characters
segments = path.split("/")