From 2613912534bba4a68e19a76752971ac75063654b Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sun, 22 May 2016 16:08:12 +0200 Subject: [PATCH] tests: Expand test suite with tests for inequality of LazyUUIDTask objects --- tasklib/tests.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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']) -- 2.39.2