def may_extend_directives_with_new_complex_directive(): extended_schema = extend_test_schema(""" directive @profile(enable: Boolean! tag: String) on QUERY | FIELD """) extended_directive = extended_schema.get_directive("profile") assert extended_directive.name == "profile" assert DirectiveLocation.QUERY in extended_directive.locations assert DirectiveLocation.FIELD in extended_directive.locations args = extended_directive.args assert list(args.keys()) == ["enable", "tag"] arg0, arg1 = args.values() assert is_non_null_type(arg0.type) is True assert is_scalar_type(arg0.type.of_type) is True assert is_scalar_type(arg1.type) is True
def returns_false_for_a_not_non_null_wrapped_type(): assert is_non_null_type(GraphQLList( GraphQLNonNull(ObjectType))) is False with raises(TypeError): assert_non_null_type(GraphQLList(GraphQLNonNull(ObjectType)))
def returns_false_for_an_unwrapped_type(): assert is_non_null_type(ObjectType) is False with raises(TypeError): assert_non_null_type(ObjectType)
def returns_true_for_a_non_null_wrapped_type(): assert is_non_null_type(GraphQLNonNull(ObjectType)) is True assert_non_null_type(GraphQLNonNull(ObjectType))