def test_parse(buffer: bytes, adapter: Adapter, instance: UUID): actual = adapter.parse(buffer) assert actual == instance
def test_build(instance: UUID, adapter: Adapter, buffer: bytes): actual = adapter.build(instance) assert actual == buffer
def __init__(self, subcon, linesize = 16, showoffset = True, showascii = True): Adapter.__init__(self, subcon) self.linesize = linesize self.showoffset = showoffset self.showascii = showascii
def __init__(self): # TODO: replace this with construct.PascalString vbs = Struct('length'/Int32ul, 'value'/Bytes(this.length - 2), Const(b'\x00\x00')) # There's always an ending null Adapter.__init__(self, vbs)
def __init__(self, subcon, **fields): Adapter.__init__(self, subcon) self.fields = fields
def __init__(self, text): Adapter.__init__(self, text)
def __init__(self, size_fn): Adapter.__init__(self, String(size_fn))
def __init__(self, subcon): Adapter.__init__(self, subcon) self.MAX = 2 ** (subcon.length * 8) - 1
def test_build(instance: EUI, buffer: bytes, adapter: Adapter): actual = adapter.build(instance) assert actual == buffer
def __init__(self, size_fn): Adapter.__init__(self, Bytes(size_fn))