From a71b47665264f6115e961918b454be962573e5df Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Sat, 18 Dec 2021 19:33:58 +0530 Subject: [PATCH] feat: repr, eq and iter for fifo queue --- erpnext/stock/valuation.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/erpnext/stock/valuation.py b/erpnext/stock/valuation.py index 33191d89ee..617e1ca15a 100644 --- a/erpnext/stock/valuation.py +++ b/erpnext/stock/valuation.py @@ -23,6 +23,17 @@ class FifoValuation: def __init__(self, state: Optional[List[FifoBin]]): self.queue: List[FifoBin] = state if state is not None else [] + def __repr__(self): + return str(self.queue) + + def __iter__(self): + return iter(self.queue) + + def __eq__(self, other): + if isinstance(other, list): + return self.queue == other + return self.queue == other.queue + def get_state(self) -> List[FifoBin]: """Get current state of queue.""" return self.queue