mitmproxy/test/netlib/test_utils.py
Aldo Cortesi cccdc98426 Utils reorganisation: add netlib.strutils
Extract a number of string and format-related functions to netlib.strutils.
2016-06-02 12:31:41 +12:00

17 lines
357 B
Python

# coding=utf-8
from netlib import utils, tutils
def test_bidi():
b = utils.BiDi(a=1, b=2)
assert b.a == 1
assert b.get_name(1) == "a"
assert b.get_name(5) is None
tutils.raises(AttributeError, getattr, b, "c")
tutils.raises(ValueError, utils.BiDi, one=1, two=1)
def test_hexdump():
assert list(utils.hexdump(b"one\0" * 10))