def schema_extension_node( directives: List[DirectiveNode], operation_types: List[OperationTypeDefinitionNode], loc: Location, ): return SchemaExtensionNode(directives=directives, operation_types=operation_types, loc=loc)
def check_type_system_extension_node(): assert not is_type_system_extension_node(Node()) assert not is_type_system_extension_node(DocumentNode()) assert is_type_system_extension_node(SchemaExtensionNode()) assert is_type_system_extension_node(TypeExtensionNode()) assert not is_type_system_extension_node(TypeSystemDefinitionNode()) assert not is_type_system_extension_node(DefinitionNode()) assert not is_type_system_extension_node(TypeNode())
def accepts_a_scalar_type_with_ast_node_and_extension_ast_nodes(): ast_node = SchemaDefinitionNode() extension_ast_nodes = [SchemaExtensionNode()] schema = GraphQLSchema( GraphQLObjectType("Query", {}), ast_node=ast_node, extension_ast_nodes=extension_ast_nodes, ) assert schema.ast_node is ast_node assert schema.extension_ast_nodes == tuple(extension_ast_nodes)
def accepts_a_scalar_type_with_ast_node_and_extension_ast_nodes(): ast_node = SchemaDefinitionNode() extension_ast_nodes = [SchemaExtensionNode()] schema = GraphQLSchema( GraphQLObjectType("Query", {}), ast_node=ast_node, extension_ast_nodes=extension_ast_nodes, ) assert schema.ast_node is ast_node assert isinstance(schema.extension_ast_nodes, FrozenList) assert schema.extension_ast_nodes == extension_ast_nodes extension_ast_nodes = schema.extension_ast_nodes schema = GraphQLSchema( GraphQLObjectType("Query", {}), ast_node=None, extension_ast_nodes=extension_ast_nodes, ) assert schema.ast_node is None assert schema.extension_ast_nodes is extension_ast_nodes
def schema_extension_node(directives, operation_types, loc): return SchemaExtensionNode( directives=directives, operation_types=operation_types, loc=loc )