Raises an AssertionError if value is not an instance of type(s).
18565
def assert_is_instance(value, types, message=None, extra=None):
    """"""
    assert isinstance(value, types), _assert_fail_message(
        message, value, types, "is not an instance of", extra
    )
419806
def is_type(value):
        """"""
        if isinstance(value, type):
            return issubclass(value, Type)
        return isinstance(value, Type)
175634
def validate(self, value):
        
        if isinstance(value, (str, unicode, int, long)):
            value = float(value)
        value = super(Float, self).validate(value)
        if not isinstance(value, (float)):
            raise ValueError("Not an float: %r" % (value, ))
        return value
1335626
def from_value(self, instance, value):
        
        try:
            parsed = self.type_.parse(value)
        except (TypeError, ValueError):
            if self.erroneous_as_absent:
                return False
            raise
        self._set_from_recv(instance, parsed)
        return True
1079327
def raise_invalid_type_exception(self):
        """"""
        message = 'Expecting element type of %s' % (
            self._parameter.element_type.__name__)
        err = ValueError(message)
        return err
387160
def _validate(cls, kind):
        """"""
        if kind not in cls._valid_kinds:
            mesg = "'kind' must be one of {}, {}, {}, or {}."
            raise ValueError(mesg.format(*cls._valid_kinds))
        else:
            return kind
85371
def validate_is_document_type(option, value):
    """"""
    if not isinstance(value, (abc.MutableMapping, RawBSONDocument)):
        raise TypeError("%s must be an instance of dict, bson.son.SON, "
                        "bson.raw_bson.RawBSONDocument, or "
                        "a type that inherits from "
                        "collections.MutableMapping" % (option,))
113645
def _ensure_value_is_valid(self, value):
        """"""
        if not isinstance(value, self.__class__.value_type):
            raise TypeError('{0} is not valid collection value, instance '
                            'of {1} required'.format(
                                value, self.__class__.value_type))
        return value
1072089
def types_validation!(value)
      raise ValidationError if types && types.none? { |type| type === value }
    end
456815
function isNotNumber(value, message, id) {
    if (message === void 0) { message = ''; }
    if (id === void 0) { id = ''; }
    if (this.enabled && (typeof value === 'number' || value instanceof Number)) {
        throw TypeException.expectedType(assertionTypes.IS_NOT_NUMBER, value, '<number>', message, id);
    }
}
1126645
def validate_type(self, type_):
        
        if type_ is not None and type_ not in self.types_set:
            raise ValueError('Invalid type for %s:%s' % (self.__class__, type_))
1182002
def type(self, value):
        
        if value not in list(defines.Types.values()):
            raise AttributeError
        self._type = value
30443
def check_type(self, value):
    

    if self.null and value is None:
      return
    if self.type is not None and not isinstance(value, self.type):
      msg = '{0!r} expected type {1}'
      raise TypeError(msg.format(self.full_name, self.type.__name__))
60173
function assertType (value, type) {
  var valid;
  var expectedType = getType(type);
  if (expectedType === 'String') {
    valid = typeof value === (expectedType = 'string');
  } else if (expectedType === 'Number') {
    valid = typeof value === (expectedType = 'number');
  } else if (expectedType === 'Boolean') {
    valid = typeof value === (expectedType = 'boolean');
  } else if (expectedType === 'Function') {
    valid = typeof value === (expectedType = 'function');
  } else if (expectedType === 'Object') {
    valid = isPlainObject(value);
  } else if (expectedType === 'Array') {
    valid = Array.isArray(value);
  } else {
    valid = value instanceof type;
  }
  return {
    valid: valid,
    expectedType: expectedType
  }
}
1262996
function assert (value, expected, method, type, identifier) {
    if (value !== expected) {
      throw new Error(method + ' only accepts ' + type + ' as ' + identifier);
    }
  }
94634
def is_valid(self, name, value):
        
        if name not in self.header_types:
            return False
        t = self.header_types[name]
        if t == ATTR_TYPE_DISCRETE:
            return isinstance(value, int)
        elif t == ATTR_TYPE_CONTINUOUS:
            return isinstance(value, (float, Decimal))
        return True
514217
def validate_float(cls, value):
        
        if not isinstance(value, (int, float)):
            raise TypeError(
                "value must be a number, got %s" % type(value)
            )