X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/blobdiff_plain/945af7d4fcb8195b5ee88a37c109cebc7ad1b210..516b8d6c03058552cfe7c3bfda4362640a3077e1:/tasklib/tests.py diff --git a/tasklib/tests.py b/tasklib/tests.py index 5a8f576..db88134 100644 --- a/tasklib/tests.py +++ b/tasklib/tests.py @@ -105,6 +105,15 @@ class TaskFilterTest(TasklibTest): self.assertEqual(len(self.tw.tasks.waiting()), 1) + def test_recurring_empty(self): + Task(self.tw, description="test task").save() + self.assertEqual(len(self.tw.tasks.recurring()), 0) + + def test_recurring_non_empty(self): + Task(self.tw, description="test task", recur="daily", + due=datetime.datetime.now()).save() + self.assertEqual(len(self.tw.tasks.recurring()), 1) + def test_filtering_by_attribute(self): Task(self.tw, description="no priority task").save() Task(self.tw, priority="H", description="high priority task").save() @@ -605,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()