aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/utils/test_typecheck.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/mitmproxy/utils/test_typecheck.py b/test/mitmproxy/utils/test_typecheck.py
index 75c932e5..0ed440eb 100644
--- a/test/mitmproxy/utils/test_typecheck.py
+++ b/test/mitmproxy/utils/test_typecheck.py
@@ -1,7 +1,9 @@
+import io
import typing
import mock
import pytest
+
from mitmproxy.utils import typecheck
@@ -66,3 +68,9 @@ def test_check_sequence():
m.__str__ = lambda self: "typing.Sequence"
m.__parameters__ = (int,)
typecheck.check_type("foo", [10], m)
+
+
+def test_check_io():
+ typecheck.check_type("foo", io.StringIO(), typing.IO[str])
+ with pytest.raises(TypeError):
+ typecheck.check_type("foo", "foo", typing.IO[str])