aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorThomas Kriechbaumer <Kriechi@users.noreply.github.com>2018-05-15 10:43:44 +0200
committerGitHub <noreply@github.com>2018-05-15 10:43:44 +0200
commita38497ac36aa72f0e431205d9c2b0394368d0810 (patch)
treef6729f2fb37933ab95544a8163932c757a984d5d /test
parentb87a1a650c02e0df3f65ec1c126eace5e9139947 (diff)
parent9979be648750b6983b233ec3a8c3c644d8c332a1 (diff)
downloadmitmproxy-a38497ac36aa72f0e431205d9c2b0394368d0810.tar.gz
mitmproxy-a38497ac36aa72f0e431205d9c2b0394368d0810.tar.bz2
mitmproxy-a38497ac36aa72f0e431205d9c2b0394368d0810.zip
Merge pull request #3121 from Kriechi/py37-dev
test on Python 3.7-dev
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/net/http/test_url.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/mitmproxy/net/http/test_url.py b/test/mitmproxy/net/http/test_url.py
index c9f61faf..ecf8e896 100644
--- a/test/mitmproxy/net/http/test_url.py
+++ b/test/mitmproxy/net/http/test_url.py
@@ -63,17 +63,21 @@ def test_unparse():
assert url.unparse("https", "foo.com", 443, "") == "https://foo.com"
-surrogates = bytes(range(256)).decode("utf8", "surrogateescape")
+# We ignore the byte 126: '~' because of an incompatibility in Python 3.6 and 3.7
+# In 3.6 it is escaped as %7E
+# In 3.7 it stays as ASCII character '~'
+# https://bugs.python.org/issue16285
+surrogates = (bytes(range(0, 126)) + bytes(range(127, 256))).decode("utf8", "surrogateescape")
surrogates_quoted = (
'%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F'
'%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F'
'%20%21%22%23%24%25%26%27%28%29%2A%2B%2C-./'
- '0123456789%3A%3B%3C%3D%3E%3F'
- '%40ABCDEFGHIJKLMNO'
- 'PQRSTUVWXYZ%5B%5C%5D%5E_'
- '%60abcdefghijklmno'
- 'pqrstuvwxyz%7B%7C%7D%7E%7F'
+ '0123456789%3A%3B%3C%3D%3E%3F%40'
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ '%5B%5C%5D%5E_%60'
+ 'abcdefghijklmnopqrstuvwxyz'
+ '%7B%7C%7D%7F' # 7E or ~ is excluded!
'%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F'
'%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F'
'%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF'