From: Tomas Babej Date: Sun, 22 May 2016 14:08:12 +0000 (+0200) Subject: tests: Expand test suite with tests for inequality of LazyUUIDTask objects X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/2613912534bba4a68e19a76752971ac75063654b?hp=dee3ee71ea684e5b4414c39aa93e14df6596c2ef tests: Expand test suite with tests for inequality of LazyUUIDTask objects --- diff --git a/tasklib/tests.py b/tasklib/tests.py index af873e1..ca2ff4a 100644 --- a/tasklib/tests.py +++ b/tasklib/tests.py @@ -1177,6 +1177,30 @@ class LazyUUIDTaskTest(TasklibTest): 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 + def test_lazy_in_queryset(self): tasks = self.tw.tasks.filter(uuid=self.stored['uuid'])