Ejemplo n.º 1
0
def test_parse(buffer: bytes, adapter: Adapter, instance: UUID):
    actual = adapter.parse(buffer)
    assert actual == instance
Ejemplo n.º 2
0
def test_build(instance: UUID, adapter: Adapter, buffer: bytes):
    actual = adapter.build(instance)
    assert actual == buffer
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 5
0
 def __init__(self, subcon, **fields):
     Adapter.__init__(self, subcon)
     self.fields = fields
Ejemplo n.º 6
0
 def __init__(self, text):
     Adapter.__init__(self, text)
Ejemplo n.º 7
0
 def __init__(self, size_fn):
     Adapter.__init__(self, String(size_fn))
Ejemplo n.º 8
0
 def __init__(self, text):
     Adapter.__init__(self, text)
Ejemplo n.º 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
Ejemplo n.º 11
0
 def __init__(self, size_fn):
     Adapter.__init__(self, Bytes(size_fn))