X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/blobdiff_plain/33c9f69e01349c7339cb669e252a4d98a08351c1..628b2d244b841be6494b87a14c3f78f0aa1cfc0e:/tasklib/tests.py diff --git a/tasklib/tests.py b/tasklib/tests.py index f7b9a27..2aebdcb 100644 --- a/tasklib/tests.py +++ b/tasklib/tests.py @@ -125,6 +125,8 @@ class TaskFilterTest(TasklibTest): filtered_task = self.tw.tasks.get(project="random") self.assertEqual(filtered_task['project'], "random") + def test_filter_with_empty_uuid(self): + self.assertRaises(ValueError, lambda: self.tw.tasks.get(uuid='')) class TaskTest(TasklibTest): @@ -495,14 +497,26 @@ class TaskTest(TasklibTest): for deserializer in deserializers: self.assertTrue(deserializer('') in (None, [], set())) - def test_normalizers_returning_empty_string_for_none(self): + def test_normalizers_handling_none(self): # Test that any normalizer can handle None as a valid value t = Task(self.tw) + + # These normalizers are not supposed to handle None + exempt_normalizers = ('normalize_uuid', ) + normalizers = [getattr(t, normalizer_name) for normalizer_name in - filter(lambda x: x.startswith('normalize_'), dir(t))] + filter(lambda x: x.startswith('normalize_'), dir(t)) + if normalizer_name not in exempt_normalizers] + for normalizer in normalizers: normalizer(None) + def test_recurrent_task_generation(self): + today = datetime.date.today() + t = Task(self.tw, description="brush teeth", + due=today, recur="daily") + t.save() + self.assertEqual(len(self.tw.tasks.pending()), 2) class TaskFromHookTest(TasklibTest):