Coverage for graphqler / graph / node.py: 92%

13 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-20 10:09 -0400

1"""A node object 

2Graphql type: One of [Object, Query, Mutation] 

3""" 

4 

5 

6class Node: 

7 def __init__(self, graphql_type: str, name: str, body: dict): 

8 """Initialize a node, saving information about the graphql type 

9 

10 Args: 

11 graphql_type (str): One of [Object, Query, Mutation] 

12 name (str): The name of the grpahql object 

13 body (dict): The body of the graphql type 

14 """ 

15 self.graphql_type = graphql_type 

16 self.mutation_type = None 

17 self.name = name 

18 self.body = body 

19 

20 def set_mutation_type(self, mutation_type: str): 

21 """Only use this if its a mutation type 

22 

23 Args: 

24 mutation_type (str): One of [CREATE,UPDATE,DELETE,UNKNOWN] 

25 """ 

26 if self.graphql_type == "Mutation": 

27 self.mutation_type = mutation_type 

28 

29 def __str__(self): 

30 return f"Node({self.graphql_type} | {self.name})" 

31 

32 def __repr__(self): 

33 return f"Node({self.graphql_type} | {self.name})"