Example #1
0
def test_parse(buffer: bytes, adapter: Adapter, instance: UUID):
    actual = adapter.parse(buffer)
    assert actual == instance
Example #2
0
def test_build(instance: UUID, adapter: Adapter, buffer: bytes):
    actual = adapter.build(instance)
    assert actual == buffer
Example #3
0
 def __init__(self, subcon, linesize = 16, showoffset = True, showascii = True):
     Adapter.__init__(self, subcon)
     self.linesize = linesize
     self.showoffset = showoffset
     self.showascii = showascii
Example #4
0
 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)
Example #5
0
 def __init__(self, subcon, **fields):
     Adapter.__init__(self, subcon)
     self.fields = fields
Example #6
0
 def __init__(self, text):
     Adapter.__init__(self, text)
Example #7
0
 def __init__(self, size_fn):
     Adapter.__init__(self, String(size_fn))
Example #8
0
 def __init__(self, text):
     Adapter.__init__(self, text)
Example #9
0
 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
Example #11
0
 def __init__(self, size_fn):
     Adapter.__init__(self, Bytes(size_fn))