@@ -286,8 +286,13 @@ class NodeOrEdgeResultSetExpression(ResultSetExpression, ABC):
286286 direction : Literal ["outwards" , "inwards" ] = "outwards"
287287 chain_to : Literal ["destination" , "source" ] = "destination"
288288
289+ def __eq__ (self , other : object ) -> bool :
290+ if not isinstance (other , NodeOrEdgeResultSetExpression ):
291+ return NotImplemented
292+ return type (self ) is type (other ) and self .dump () == other .dump ()
289293
290- @dataclass
294+
295+ @dataclass (eq = False ) # Prevents @dataclass from generating its own __eq__, so the parent's is used
291296class NodeResultSetExpression (NodeOrEdgeResultSetExpression ):
292297 """Describes how to query for nodes in the data model.
293298
@@ -355,7 +360,7 @@ def dump(self, camel_case: bool = True) -> dict[str, Any]:
355360 return output
356361
357362
358- @dataclass
363+ @dataclass ( eq = False ) # Prevents @dataclass from generating its own __eq__, so the parent's is used
359364class EdgeResultSetExpression (NodeOrEdgeResultSetExpression ):
360365 """Describes how to query for edges in the data model.
361366
@@ -439,6 +444,11 @@ class ResultSetExpressionSync(ResultSetExpressionBase, ABC):
439444 sync_mode : SyncMode | None = None
440445 backfill_sort : list [InstanceSort ] = field (default_factory = list )
441446
447+ def __eq__ (self , other : object ) -> bool :
448+ if not isinstance (other , ResultSetExpressionSync ):
449+ return NotImplemented
450+ return type (self ) is type (other ) and self .dump () == other .dump ()
451+
442452 @classmethod
443453 def _load (cls , resource : dict [str , Any ]) -> ResultSetExpressionSync :
444454 if "nodes" in resource :
@@ -475,7 +485,7 @@ def _dump_sync_mode(sync_mode: SyncMode, camel_case: bool = True) -> str:
475485 assert_never (sync_mode )
476486
477487
478- @dataclass
488+ @dataclass ( eq = False ) # Prevents @dataclass from generating its own __eq__, so the parent's is used
479489class NodeResultSetExpressionSync (ResultSetExpressionSync ):
480490 """Describes how to query for nodes in the data model.
481491
@@ -562,7 +572,7 @@ def dump(self, camel_case: bool = True) -> dict[str, Any]:
562572 return output
563573
564574
565- @dataclass
575+ @dataclass ( eq = False ) # Prevents @dataclass from generating its own __eq__, so the parent's is used
566576class EdgeResultSetExpressionSync (ResultSetExpressionSync ):
567577 """Describes how to query for edges in the data model.
568578
0 commit comments