def test_auto_label(self): # One word field = steel.Bytes(size=1) field.set_name('byte') self.assertEqual(field.label, 'byte') # Two words field = steel.Bytes(size=1) field.set_name('two_bytes') self.assertEqual(field.label, 'two bytes')
def setUp(self): self.field = steel.Bytes(size=1, map={ b'a': 'A', b'b': 'B', b'c': 'C', })
def test_decode(self): field = steel.Bytes(size=3) self.assertEqual(field.decode(b'abc'), b'abc')
class B(steel.Structure): field1 = steel.Bytes(size=3) field2 = steel.Bytes(size=3)
def test_manual_label(self): field = steel.Bytes(size=1, label='explicit') field.set_name('field') self.assertEqual(field.label, 'explicit')
class Test(steel.Structure): field1 = steel.Bytes(size=2) field2 = steel.Bytes(size=4) field3 = steel.Bytes(size=1)
class Test(steel.Structure): field1 = steel.Bytes(offset=2, size=2) field2 = steel.Bytes(offset=10, size=4) field3 = steel.Bytes(offset=16, size=1)