def _cast_to_type(self, value):
        """ Convert the value to a float and raise error on failures"""
        try:
            return float(value)
        except (ValueError, TypeError):
            self.fail('invalid', value=value)
Convert the value to a float and raise error on failures