def testGetByte(self): self.assertEqual(5, fdt_util.GetByte(self.node, 'byteval')) self.assertEqual(3, fdt_util.GetByte(self.node, 'missing', 3)) with self.assertRaises(ValueError) as e: fdt_util.GetByte(self.node, 'longbytearray') self.assertIn("property 'longbytearray' has list value: expecting a " 'single byte', str(e.exception)) with self.assertRaises(ValueError) as e: fdt_util.GetByte(self.node, 'intval') self.assertIn("property 'intval' has length 4, expecting 1", str(e.exception))
def ReadNode(self): Entry.ReadNode(self) if self.size is None: self.Raise("'fill' entry must have a size property") self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0)
def __init__(self, section, etype, node): Entry.__init__(self, section, etype, node) if self.size is None: self.Raise("'fill' entry must have a size property") self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0)