From 44bcf1ece468e5befbbdbbd457ff28a09bb75901 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Fri, 8 Jul 2016 13:53:04 +0200 Subject: [PATCH 1/1] tests: Add tests for unequality of hashes of different tasks --- tasklib/tests.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tasklib/tests.py b/tasklib/tests.py index 77f1980..db88134 100644 --- a/tasklib/tests.py +++ b/tasklib/tests.py @@ -614,6 +614,23 @@ class TaskTest(TasklibTest): t2 = self.tw.tasks.get(uuid=t1['uuid']) self.assertEqual(t1.__hash__(), t2.__hash__()) + def test_hash_unequal_unsaved_tasks(self): + # Compare the hash of the task using two different objects + t1 = Task(self.tw, description="test task 1") + t2 = Task(self.tw, description="test task 2") + + self.assertNotEqual(t1.__hash__(), t2.__hash__()) + + def test_hash_unequal_saved_tasks(self): + # Compare the hash of the task using two different objects + t1 = Task(self.tw, description="test task 1") + t2 = Task(self.tw, description="test task 2") + + t1.save() + t2.save() + + self.assertNotEqual(t1.__hash__(), t2.__hash__()) + def test_adding_task_with_priority(self): t = Task(self.tw, description="test task", priority="M") t.save() -- 2.39.5