def throw_error_with_path(): with raises(GraphQLError) as exc_info: assert coerce_input_value([None], GraphQLList( GraphQLNonNull(GraphQLInt))) assert exc_info.value.message == ( "Invalid value None at 'value[0]':" " Expected non-nullable type 'Int!' not to be None.")
def _coerce_value(input_value, type_): errors: List[CoercedValueError] = [] append = errors.append def on_error(path, invalid_value, error): append(CoercedValueError(error.message, path, invalid_value)) value = coerce_input_value(input_value, type_, on_error) return CoercedValue(errors, value)
def throw_error_without_path(): with raises(GraphQLError) as exc_info: assert coerce_input_value(None, GraphQLNonNull(GraphQLInt)) assert exc_info.value.message == ( "Invalid value None: Expected non-nullable type 'Int!' not to be None." )