aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2016-12-12 12:53:26 +1300
committerGitHub <noreply@github.com>2016-12-12 12:53:26 +1300
commit5cf268b012697730c37df9d46c2f580f8184ef08 (patch)
tree0c0dd016713e19e6f7be121018d90743e6b8704f /test
parent980a84326bf2daa398b201fd3722696476c4913d (diff)
parent5e2a80fba1589604f7f310ea143ff24ea2dd0aa9 (diff)
downloadmitmproxy-5cf268b012697730c37df9d46c2f580f8184ef08.tar.gz
mitmproxy-5cf268b012697730c37df9d46c2f580f8184ef08.tar.bz2
mitmproxy-5cf268b012697730c37df9d46c2f580f8184ef08.zip
Merge pull request #1842 from cortesi/optsave
Save options to file from console & related work
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/console/test_pathedit.py2
-rw-r--r--test/mitmproxy/utils/test_typecheck.py13
2 files changed, 13 insertions, 2 deletions
diff --git a/test/mitmproxy/console/test_pathedit.py b/test/mitmproxy/console/test_pathedit.py
index 40d55353..b326ed6d 100644
--- a/test/mitmproxy/console/test_pathedit.py
+++ b/test/mitmproxy/console/test_pathedit.py
@@ -54,7 +54,7 @@ class TestPathEdit:
def test_keypress(self):
- pe = pathedit.PathEdit()
+ pe = pathedit.PathEdit("", "")
with patch('urwid.widget.Edit.get_edit_text') as get_text, \
patch('urwid.widget.Edit.set_edit_text') as set_text:
diff --git a/test/mitmproxy/utils/test_typecheck.py b/test/mitmproxy/utils/test_typecheck.py
index 85684df9..3ec74b20 100644
--- a/test/mitmproxy/utils/test_typecheck.py
+++ b/test/mitmproxy/utils/test_typecheck.py
@@ -26,6 +26,8 @@ def test_check_type():
typecheck.check_type("foo", 42, str)
with pytest.raises(TypeError):
typecheck.check_type("foo", None, str)
+ with pytest.raises(TypeError):
+ typecheck.check_type("foo", b"foo", str)
def test_check_union():
@@ -44,5 +46,14 @@ def test_check_tuple():
typecheck.check_type("foo", (42, 42), typing.Tuple[int, str])
with pytest.raises(TypeError):
typecheck.check_type("foo", ("42", 42), typing.Tuple[int, str])
-
typecheck.check_type("foo", (42, "42"), typing.Tuple[int, str])
+
+
+def test_check_sequence():
+ typecheck.check_type("foo", [10], typing.Sequence[int])
+ with pytest.raises(TypeError):
+ typecheck.check_type("foo", ["foo"], typing.Sequence[int])
+ with pytest.raises(TypeError):
+ typecheck.check_type("foo", [10, "foo"], typing.Sequence[int])
+ with pytest.raises(TypeError):
+ typecheck.check_type("foo", [b"foo"], typing.Sequence[str])