From 0cb693700f39f096e6337ccceab4f4b82b293557 Mon Sep 17 00:00:00 2001 From: Jan Lis <114775140+janlis-ff@users.noreply.github.com> Date: Mon, 17 Oct 2022 11:20:59 +0200 Subject: [PATCH] add `__eq__` method for `OperandHolder` class (#8710) --- rest_framework/permissions.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rest_framework/permissions.py b/rest_framework/permissions.py index 16459b251..f3ebbcffa 100644 --- a/rest_framework/permissions.py +++ b/rest_framework/permissions.py @@ -46,6 +46,14 @@ class OperandHolder(OperationHolderMixin): 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):