aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-12-28 13:39:27 +0100
committerMaximilian Hils <git@maximilianhils.com>2016-12-28 14:20:53 +0100
commit0929e74b4e82e3ee9ba1d6ddb7a54a68240a4282 (patch)
tree5e2d59a2f56d002f00b6ba44dc90433efc49ade2 /test
parent8185cf27243a7c982ff4c3151045b3d494396740 (diff)
downloadmitmproxy-0929e74b4e82e3ee9ba1d6ddb7a54a68240a4282.tar.gz
mitmproxy-0929e74b4e82e3ee9ba1d6ddb7a54a68240a4282.tar.bz2
mitmproxy-0929e74b4e82e3ee9ba1d6ddb7a54a68240a4282.zip
fix compat with Python 3.5.0
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/utils/test_typecheck.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/mitmproxy/utils/test_typecheck.py b/test/mitmproxy/utils/test_typecheck.py
index 3ec74b20..75c932e5 100644
--- a/test/mitmproxy/utils/test_typecheck.py
+++ b/test/mitmproxy/utils/test_typecheck.py
@@ -1,5 +1,6 @@
import typing
+import mock
import pytest
from mitmproxy.utils import typecheck
@@ -57,3 +58,11 @@ def test_check_sequence():
typecheck.check_type("foo", [10, "foo"], typing.Sequence[int])
with pytest.raises(TypeError):
typecheck.check_type("foo", [b"foo"], typing.Sequence[str])
+ with pytest.raises(TypeError):
+ typecheck.check_type("foo", "foo", typing.Sequence[str])
+
+ # Python 3.5.0 only defines __parameters__
+ m = mock.Mock()
+ m.__str__ = lambda self: "typing.Sequence"
+ m.__parameters__ = (int,)
+ typecheck.check_type("foo", [10], m)