From 4da9b8fa085b6089c35573c6638fa137c131c30d Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sat, 7 Feb 2015 12:35:47 +0100 Subject: [PATCH 1/1] Tests: Add test for filtering with empty UUID --- tasklib/tests.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tasklib/tests.py b/tasklib/tests.py index 3ff1ebf..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,11 +497,17 @@ 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) -- 2.39.5