Check assertions.

    :param context: test context.
345270
def step_impl03(context):
    
    assert len(context.buf) == len(context.fuzzed_buf)
    count = number_of_modified_bytes(context.buf, context.fuzzed_buf)
    assert count < 3
    assert count >= 0
534463
private void checkForContextHeadRevision(String contextId, UUID expectedHeadRevision)
        throws EKBConcurrentException {
        if (!Objects.equal(edbService.getLastRevisionNumberOfContext(contextId), expectedHeadRevision)) {
            throw new EKBConcurrentException("The current revision of the context does not match the "
                    + "expected one.");
        }
    }
380757
def on_assert(self, node):    # ('test', 'msg')
        """"""
        if not self.run(node.test):
            self.raise_exception(node, exc=AssertionError, msg=node.msg)
        return True
56514
protected function doExecute(AssertionContext $context)
    {
        $nameId = $this->nameIdProvider->getNameID($context);
        if ($nameId) {
            if (null == $context->getAssertion()->getSubject()) {
                $context->getAssertion()->setSubject(new Subject());
            }
            $context->getAssertion()->getSubject()->setNameID($nameId);
        }
    }
1252972
def is_valid(self, context):
        
        if self.requires:
            for r in self.requires:
                if not r in context.executed_actions:
                    raise RequirementMissingError("Action '%s' requires '%s'" % (self.name, r))
        return True
840085
function checkNonceMatch(context) {
    var newNonce1 = Buffer.concat([utility.string2Buffer(context.newNonce, 32), new Buffer([1]), context.authKeyAuxHash]);
    var newNonceHash = utility.buffer2String(utility.createSHAHash(newNonce1).slice(-16));
    var serverNewNonceHash = context.setClientDHParamsAnswer.new_nonce_hash1;
    if (logger.isDebugEnabled()) {
        logger.debug('newNonceHash = %s, new_nonce_hash1 = %s', newNonceHash.toString(), serverNewNonceHash.toString());
    }
    if (newNonceHash !== serverNewNonceHash) {
        logger.warn('\'dh_gen_ok.new_nonce_hash1\' check fails!');
        throw createError(newNonceHash + ' != ' + serverNewNonceHash, 'EREPLAYATTACK');
    }
    return context;
}
446653
protected function doExecute(AssertionContext $context)
    {
        $ownEntityDescriptor = $context->getProfileContext()->getOwnEntityDescriptor();

        $issuer = new Issuer($ownEntityDescriptor->getEntityID());
        $issuer->setFormat(SamlConstants::NAME_ID_FORMAT_ENTITY);

        $context->getAssertion()->setIssuer($issuer);

        $this->logger->debug(
            sprintf('Assertion Issuer set to "%s"', $ownEntityDescriptor->getEntityID()),
            LogHelper::getActionContext($context, $this)
        );
    }
209347
protected final boolean isAuthenticated(Context context) {
        Account account = context.getSession(AuthConstants.ACCOUNT_ATTRIBUTE);
        if (account == null) {
            account = context.getLocal(AuthConstants.ACCOUNT_ATTRIBUTE);
        }
        return account != null && account.isAuthenticated();
    }
831617
private synchronized void addContext(final EvaluatorContext context) {
    this.contextStack.add(context);
    this.contextIds.add(context.getId());
  }
92490
protected function doExecute(AssertionContext $context)
    {
        $partyEntityDescriptor = $context->getProfileContext()->getPartyEntityDescriptor();

        $conditions = new Conditions();
        $conditions->setNotBefore($this->timeProvider->getTimestamp());
        $conditions->setNotOnOrAfter($conditions->getNotBeforeTimestamp() + $this->expirationSeconds);

        $audienceRestriction = new AudienceRestriction(array(
            $partyEntityDescriptor->getEntityID(),
        ));
        $conditions->addItem($audienceRestriction);

        $context->getAssertion()->setConditions($conditions);
    }
1089890
def check(self, radl):
        """"""

        if not isinstance(self.max_time, int) or self.max_time < 0:
            raise RADLParseException("Invalid 'max time' in 'contextualize'",
                                     line=self.line)
        if self.items is not None:
            for i in self.items.values():
                i.check(radl)
116020
def _verify_safe(self, this):
        """"""
        context = self._context
        if context & contexts.FAIL_NEXT:
            return False
        if context & contexts.WIKILINK_TITLE:
            if this == "]" or this == "{":
                self._context |= contexts.FAIL_NEXT
            elif this == "\n" or this == "[" or this == "}" or this == ">":
                return False
            elif this == "<":
                if self._read(1) == "!":
                    self._context |= contexts.FAIL_NEXT
                else:
                    return False
            return True
        elif context & contexts.EXT_LINK_TITLE:
            return this != "\n"
        elif context & contexts.TEMPLATE_NAME:
            if this == "{":
                self._context |= contexts.HAS_TEMPLATE | contexts.FAIL_NEXT
                return True
            if this == "}" or (this == "<" and self._read(1) == "!"):
                self._context |= contexts.FAIL_NEXT
                return True
            if this == "[" or this == "]" or this == "<" or this == ">":
                return False
            if this == "|":
                return True
            if context & contexts.HAS_TEXT:
                if context & contexts.FAIL_ON_TEXT:
                    if this is self.END or not this.isspace():
                        return False
                elif this == "\n":
                    self._context |= contexts.FAIL_ON_TEXT
            elif this is self.END or not this.isspace():
                self._context |= contexts.HAS_TEXT
            return True
        elif context & contexts.TAG_CLOSE:
            return this != "<"
        else:
            if context & contexts.FAIL_ON_EQUALS:
                if this == "=":
                    return False
            elif context & contexts.FAIL_ON_LBRACE:
                if this == "{" or (self._read(-1) == self._read(-2) == "{"):
                    if context & contexts.TEMPLATE:
                        self._context |= contexts.FAIL_ON_EQUALS
                    else:
                        self._context |= contexts.FAIL_NEXT
                    return True
                self._context ^= contexts.FAIL_ON_LBRACE
            elif context & contexts.FAIL_ON_RBRACE:
                if this == "}":
                    self._context |= contexts.FAIL_NEXT
                    return True
                self._context ^= contexts.FAIL_ON_RBRACE
            elif this == "{":
                self._context |= contexts.FAIL_ON_LBRACE
            elif this == "}":
                self._context |= contexts.FAIL_ON_RBRACE
            return True
714153
def assert_called(_mock_self):
        
        self = _mock_self
        if self.call_count == 0:
            msg = ("Expected '%s' to have been called." %
                   self._mock_name or 'mock')
            raise AssertionError(msg)
1236258
private void performChecks(Contextual<?> contextual) {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "performChecks", this);

        if (!isActive()) {
            throw new ContextNotActiveException();
        }

        if (contextual == null) {
            throw new IllegalArgumentException("Contextual parameter should not be null");
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "performChecks");
    }
881204
private void findErrorMessages(FacesContext context) {
        if (context.getMessageList().isEmpty() || context.isValidationFailed()) {
            return;
        }
        for (FacesMessage msg : context.getMessageList()) {
            if (msg.getSeverity().equals(FacesMessage.SEVERITY_ERROR) || msg.getSeverity().equals(FacesMessage.SEVERITY_FATAL)) {
                validationFailed(context);
                break;
            }
        }
    }
410043
def is_contextfree(self):
        """"""
        for lhs, rhs in self.rules:
            if len(lhs) != 1:
                return False
            if lhs[0] not in self.nonterminals:
                return False
        return True
4001
protected static void checkSameExecutionContext(DataSet<?> set1, DataSet<?> set2) {
		if (set1.context != set2.context) {
			throw new IllegalArgumentException("The two inputs have different execution contexts.");
		}
	}