From 0e2027227eb7041239a45e071f09f51451fb15be Mon Sep 17 00:00:00 2001 From: kraanzu Date: Thu, 14 Nov 2024 21:53:16 +0530 Subject: [PATCH] fix: test_sort_pending --- tests/test_core/test_todo.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/test_core/test_todo.py b/tests/test_core/test_todo.py index 3d457ae6..3536c3d4 100644 --- a/tests/test_core/test_todo.py +++ b/tests/test_core/test_todo.py @@ -223,11 +223,9 @@ def _sort_before_and_after(self, field) -> Tuple[List[Todo], List[Todo]]: return old_todos, new_descriptions def test_sort_pending(self): - _, new = self._sort_before_and_after("pending") - values_dict = {"completed": 3, "pending": 2, "overdue": 1} - values = [values_dict[t.status] for t in new] - - self.assertEqual(values, sorted(values)) + old, new = self._sort_before_and_after("pending") + old.sort(key=lambda x: (not x.pending, x.due or datetime.max, x.order_index)) + self.assertEqual([i.id for i in old], [i.id for i in new]) def test_sort_description(self): old, new = self._sort_before_and_after("description")