def _CheckLUResult(self, op, result): """Check the LU result against the contract in the opcode. """ resultcheck_fn = op.OP_RESULT if not (resultcheck_fn is None or resultcheck_fn(result)): logging.error("Expected opcode result matching %s, got %s", resultcheck_fn, result) if not getattr(op, "dry_run", False): # FIXME: LUs should still behave in dry_run mode, or # alternately we should have OP_DRYRUN_RESULT; in the # meantime, we simply skip the OP_RESULT check in dry-run mode raise errors.OpResultError("Opcode result does not match %s: %s" % (resultcheck_fn, utils.Truncate(result, 80)))
def _Test(self, text, length): result = utils.Truncate(text, length) self.assertTrue(len(result) <= length) return result