Skip to content

Commit

Permalink
Implement __eq__ for FRRoutingPrefix & CabourotteHealthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
SRv6d committed Dec 5, 2023
1 parent 2b8e0bb commit 644786d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/anycastd/healthcheck/_cabourotte/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ def __repr__(self) -> str:
f"interval={self.interval!r})"
)

def __eq__(self, other: object) -> bool:
if not isinstance(other, CabourotteHealthcheck):
return NotImplemented

return self.__dict__ == other.__dict__

@property
def interval(self) -> datetime.timedelta:
return self.__interval
Expand Down
6 changes: 6 additions & 0 deletions src/anycastd/prefix/_frrouting/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ def __repr__(self) -> str:
f"vtysh={self.vtysh!r}, executor={self.executor!r})"
)

def __eq__(self, other: object) -> bool:
if not isinstance(other, FRRoutingPrefix):
return NotImplemented

return self.__dict__ == other.__dict__

@property
def prefix(self) -> IPv4Network | IPv6Network:
return self.__prefix
Expand Down

0 comments on commit 644786d

Please sign in to comment.