diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2015-04-30 09:04:22 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2015-04-30 09:04:22 +1200 |
commit | 80860229209b4c6eb8384e1bca3cabdbe062fe6e (patch) | |
tree | ed0bb19910d81b9b8b8719b4c9fc34a40baa6919 /test/test_utils.py | |
parent | b7a2fc85537dca60fb18d25965289d876bd3bd38 (diff) | |
download | mitmproxy-80860229209b4c6eb8384e1bca3cabdbe062fe6e.tar.gz mitmproxy-80860229209b4c6eb8384e1bca3cabdbe062fe6e.tar.bz2 mitmproxy-80860229209b4c6eb8384e1bca3cabdbe062fe6e.zip |
Add a tiny utility class for keeping bi-directional mappings.
Use it in websocket and socks.
Diffstat (limited to 'test/test_utils.py')
-rw-r--r-- | test/test_utils.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index 971e5076..0cdd3fae 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -1,5 +1,14 @@ from netlib import utils -import socket +import tutils + + +def test_bidi(): + b = utils.BiDi(a=1, b=2) + assert b.a == 1 + assert b[1] == "a" + tutils.raises(AttributeError, getattr, b, "c") + tutils.raises(KeyError, b.__getitem__, 5) + def test_hexdump(): assert utils.hexdump("one\0"*10) |