]> git.madduck.net Git - etc/taskwarrior.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge branch 'develop'
authorRob Golding-Day <rob@golding-day.com>
Mon, 27 May 2019 18:59:05 +0000 (19:59 +0100)
committerRob Golding-Day <rob@golding-day.com>
Mon, 27 May 2019 18:59:05 +0000 (19:59 +0100)
docs/conf.py
setup.py
tasklib/lazy.py
tasklib/tests.py

index 9c7dbedb0611ea2584c92127066d5e83aba3f0e9..3892461fc862e71f4e6fd3245eb05e24302443eb 100644 (file)
@@ -51,9 +51,9 @@ copyright = u'2014, Rob Golding'
 # built documents.
 #
 # The short X.Y version.
-version = '1.2.0'
+version = '1.2.1'
 # The full version, including alpha/beta/rc tags.
-release = '1.2.0'
+release = '1.2.1'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
index 510136ee97c5e0e16f824c63bc9d47c62305e4cf..42da23e8fba01034e64bfd1ae2e2f9c5aac3c51d 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
 
 install_requirements = ['six>=1.4', 'pytz', 'tzlocal']
 
-version = '1.2.0'
+version = '1.2.1'
 
 try:
     import importlib
index cb268f3859272754332b556e957b243d43d9c223..e5b34925b99f5d38aaedba73b2d6bed7f7174d04 100644 (file)
@@ -106,7 +106,7 @@ class LazyUUIDTaskSet(object):
         return 'LazyUUIDTaskSet([{0}])'.format(', '.join(self._uuids))
 
     def __eq__(self, other):
-        return set(t['uuid'] for t in other) == self._uuids
+        return (set(t['uuid'] for t in other) if other else set()) == self._uuids
 
     def __ne__(self, other):
         return not (self == other)
index 1fd449caa893d1bfbfb40274adff299e4b9d8990..5b1ff62af84fae88595e4c93e9d7bc2950ecfccb 100644 (file)
@@ -530,6 +530,18 @@ class TaskTest(TasklibTest):
 
         self.assertEqual(t['depends'], set([dependency]))
 
+    def test_set_simple_dependency_lazyuuidtaskset(self):
+        # Adds only one dependency as a LazyUUIDTaskSet to task with no dependencies
+        t = Task(self.tw, description='test task')
+        dependency = Task(self.tw, description='needs to be done first')
+
+        t.save()
+        dependency.save()
+
+        t['depends'] = LazyUUIDTaskSet(self.tw, [dependency['uuid']])
+
+        self.assertEqual(t['depends'], LazyUUIDTaskSet(self.tw, [dependency['uuid']]))
+
     def test_set_complex_dependency_set(self):
         # Adds two dependencies to task with no dependencies
         t = Task(self.tw, description='test task')
@@ -544,6 +556,20 @@ class TaskTest(TasklibTest):
 
         self.assertEqual(t['depends'], set([dependency1, dependency2]))
 
+    def test_set_complex_dependency_lazyuuidtaskset(self):
+        # Adds two dependencies as a LazyUUIDTaskSet to task with no dependencies
+        t = Task(self.tw, description='test task')
+        dependency1 = Task(self.tw, description='needs to be done first')
+        dependency2 = Task(self.tw, description='needs to be done second')
+
+        t.save()
+        dependency1.save()
+        dependency2.save()
+
+        t['depends'] = LazyUUIDTaskSet(self.tw, [dependency1['uuid'], dependency2['uuid']])
+
+        self.assertEqual(t['depends'], LazyUUIDTaskSet(self.tw, [dependency1['uuid'], dependency2['uuid']]))
+
     def test_remove_from_dependency_set(self):
         # Removes dependency from task with two dependencies
         t = Task(self.tw, description='test task')
@@ -561,6 +587,23 @@ class TaskTest(TasklibTest):
 
         self.assertEqual(t['depends'], set([dependency1]))
 
+    def test_remove_from_dependency_lazyuuidtaskset(self):
+        # Removes dependency from task with two dependencies as LazyUUIDTaskSet
+        t = Task(self.tw, description='test task')
+        dependency1 = Task(self.tw, description='needs to be done first')
+        dependency2 = Task(self.tw, description='needs to be done second')
+
+        dependency1.save()
+        dependency2.save()
+
+        t['depends'] = LazyUUIDTaskSet(self.tw, [dependency1['uuid'], dependency2['uuid']])
+        t.save()
+
+        t['depends'].remove(dependency2)
+        t.save()
+
+        self.assertEqual(t['depends'], LazyUUIDTaskSet(self.tw, [dependency1['uuid']]))
+
     def test_add_to_dependency_set(self):
         # Adds dependency to task with one dependencies
         t = Task(self.tw, description='test task')
@@ -578,8 +621,42 @@ class TaskTest(TasklibTest):
 
         self.assertEqual(t['depends'], set([dependency1, dependency2]))
 
+    def test_add_to_dependency_lazyuuidtaskset(self):
+        # Adds dependency to task with one dependencies as LazyUUIDTaskSet
+        t = Task(self.tw, description='test task')
+        dependency1 = Task(self.tw, description='needs to be done first')
+        dependency2 = Task(self.tw, description='needs to be done second')
+
+        dependency1.save()
+        dependency2.save()
+
+        t['depends'] = LazyUUIDTaskSet(self.tw, [dependency1['uuid']])
+        t.save()
+
+        t['depends'].add(dependency2)
+        t.save()
+
+        self.assertEqual(t['depends'], LazyUUIDTaskSet(self.tw, [dependency1['uuid'], dependency2['uuid']]))
+
+    def test_add_lazyuuidtaskset_to_dependency_lazyuuidtaskset(self):
+        # Adds dependency as LazyUUIDTaskSet to task with one dependencies as LazyUUIDTaskSet
+        t = Task(self.tw, description='test task')
+        dependency1 = Task(self.tw, description='needs to be done first')
+        dependency2 = Task(self.tw, description='needs to be done second')
+
+        dependency1.save()
+        dependency2.save()
+
+        t['depends'] = LazyUUIDTaskSet(self.tw, [dependency1['uuid']])
+        t.save()
+
+        t['depends'] = LazyUUIDTaskSet(self.tw, [dependency2['uuid']]).union(t['depends'])
+        t.save()
+
+        self.assertEqual(t['depends'], LazyUUIDTaskSet(self.tw, [dependency1['uuid'], dependency2['uuid']]))
+
     def test_add_to_empty_dependency_set(self):
-        # Adds dependency to task with one dependencies
+        # Adds dependency to task with no dependencies
         t = Task(self.tw, description='test task')
         dependency = Task(self.tw, description='needs to be done first')
 
@@ -590,6 +667,18 @@ class TaskTest(TasklibTest):
 
         self.assertEqual(t['depends'], set([dependency]))
 
+    def test_add_to_empty_dependency_lazyuuidtaskset(self):
+        # Adds dependency as LazyUUIDTaskSet to task with no dependencies
+        t = Task(self.tw, description='test task')
+        dependency = Task(self.tw, description='needs to be done first')
+
+        dependency.save()
+
+        t['depends'] = LazyUUIDTaskSet(self.tw, [dependency['uuid']])
+        t.save()
+
+        self.assertEqual(t['depends'], LazyUUIDTaskSet(self.tw, [dependency['uuid']]))
+
     def test_simple_dependency_set_save_repeatedly(self):
         # Adds only one dependency to task with no dependencies
         t = Task(self.tw, description='test task')
@@ -612,6 +701,40 @@ class TaskTest(TasklibTest):
 
         self.assertEqual(t['depends'], set([dependency]))
 
+    def test_simple_dependency_lazyuuidtaskset_save_repeatedly(self):
+        # Adds only one dependency as LazyUUIDTaskSet to task with no dependencies
+        t = Task(self.tw, description='test task')
+        dependency = Task(self.tw, description='needs to be done first')
+        dependency.save()
+
+        t['depends'] = LazyUUIDTaskSet(self.tw, [dependency['uuid']])
+        t.save()
+
+        # We taint the task, but keep depends intact
+        t['description'] = 'test task modified'
+        t.save()
+
+        self.assertEqual(t['depends'], LazyUUIDTaskSet(self.tw, [dependency['uuid']]))
+
+        # We taint the task, but assign the same set to the depends
+        t['depends'] = LazyUUIDTaskSet(self.tw, [dependency['uuid']])
+        t['description'] = 'test task modified again'
+        t.save()
+
+        self.assertEqual(t['depends'], LazyUUIDTaskSet(self.tw, [dependency['uuid']]))
+
+    def test_simple_dependency_lazyuuidtaskset_save_before_repeatedly(self):
+        # Adds only one dependency as LazyUUIDTaskSet to a saved task with no dependencies
+        t = Task(self.tw, description='test task')
+        dependency = Task(self.tw, description='needs to be done first')
+        dependency.save()
+        t.save()
+
+        t['depends'] = LazyUUIDTaskSet(self.tw, [dependency['uuid']])
+        t.save()
+
+        self.assertEqual(t['depends'], LazyUUIDTaskSet(self.tw, [dependency['uuid']]))
+
     def test_compare_different_tasks(self):
         # Negative: compare two different tasks
         t1 = Task(self.tw, description='test task')