Skip to content

Commit

Permalink
add __eq__ method for OperandHolder class (#8710)
Browse files Browse the repository at this point in the history
  • Loading branch information
janlis-ff authored Oct 17, 2022
1 parent b221aa2 commit 0cb6937
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions rest_framework/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ def __call__(self, *args, **kwargs):
op2 = self.op2_class(*args, **kwargs)
return self.operator_class(op1, op2)

def __eq__(self, other):
return (
isinstance(other, OperandHolder) and
self.operator_class == other.operator_class and
self.op1_class == other.op1_class and
self.op2_class == other.op2_class
)


class AND:
def __init__(self, op1, op2):
Expand Down

0 comments on commit 0cb6937

Please sign in to comment.