Esempio n. 1
0
def assert_sdl_validation_errors(
    rule: Type[SDLValidationRule],
    sdl_str: str,
    errors: List[GraphQLError],
    schema: Optional[GraphQLSchema] = None,
) -> List[GraphQLError]:
    doc = parse(sdl_str)
    returned_errors = validate_sdl(doc, schema, [rule])
    assert returned_errors == errors
    return returned_errors
Esempio n. 2
0
def expect_sdl_errors_from_rule(rule, sdl_string, schema=None):
    errors = validate_sdl(parse(sdl_string), schema, [rule])
    return errors
Esempio n. 3
0
def test_validate_sdl_document(benchmark, big_schema_sdl):  # noqa: F811
    sdl_ast = parse(big_schema_sdl)
    result = benchmark(lambda: validate_sdl(sdl_ast))
    assert result == []