self.tw.tasks.all()[0].done()
self.assertEqual(len(self.tw.tasks.completed()), 1)
+ def test_deleted_empty(self):
+ Task(self.tw, description="test task").save()
+ self.assertEqual(len(self.tw.tasks.deleted()), 0)
+
+ def test_deleted_non_empty(self):
+ Task(self.tw, description="test task").save()
+ self.assertEqual(len(self.tw.tasks.deleted()), 0)
+ self.tw.tasks.all()[0].delete()
+ self.assertEqual(len(self.tw.tasks.deleted()), 1)
+
+ def test_waiting_empty(self):
+ Task(self.tw, description="test task").save()
+ self.assertEqual(len(self.tw.tasks.waiting()), 0)
+
+ def test_waiting_non_empty(self):
+ Task(self.tw, description="test task").save()
+ self.assertEqual(len(self.tw.tasks.waiting()), 0)
+
+ t = self.tw.tasks.all()[0]
+ t['wait'] = datetime.datetime.now() + datetime.timedelta(days=1)
+ t.save()
+
+ self.assertEqual(len(self.tw.tasks.waiting()), 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()
def test_normal_to_lazy_equality(self):
assert self.stored == self.lazy
+ assert not self.stored != self.lazy
assert type(self.lazy) is LazyUUIDTask
def test_lazy_to_lazy_equality(self):
lazy2 = LazyUUIDTask(self.tw, self.stored['uuid'])
assert lazy1 == lazy2
+ assert not lazy1 != lazy2
+ assert type(lazy1) is LazyUUIDTask
+ assert type(lazy2) is LazyUUIDTask
+
+ def test_normal_to_lazy_inequality(self):
+ # Create a different UUID by changing the last letter
+ wrong_uuid = self.stored['uuid']
+ wrong_uuid = wrong_uuid[:-1] + ('a' if wrong_uuid[-1] != 'a' else 'b')
+
+ wrong_lazy = LazyUUIDTask(self.tw, wrong_uuid)
+
+ assert not self.stored == wrong_lazy
+ assert self.stored != wrong_lazy
+ assert type(wrong_lazy) is LazyUUIDTask
+
+ def test_lazy_to_lazy_inequality(self):
+ # Create a different UUID by changing the last letter
+ wrong_uuid = self.stored['uuid']
+ wrong_uuid = wrong_uuid[:-1] + ('a' if wrong_uuid[-1] != 'a' else 'b')
+
+ lazy1 = LazyUUIDTask(self.tw, self.stored['uuid'])
+ lazy2 = LazyUUIDTask(self.tw, wrong_uuid)
+
+ assert not lazy1 == lazy2
+ assert lazy1 != lazy2
assert type(lazy1) is LazyUUIDTask
assert type(lazy2) is LazyUUIDTask