TW-1634: due.not:<date> excludes only tasks scheduled at mitnight

- Thanks to Tomas Babej.
This commit is contained in:
Paul Beckingham 2015-07-19 14:48:35 -04:00
parent d18a46da01
commit 7ee8ad4e44
3 changed files with 34 additions and 26 deletions

View file

@ -51,6 +51,8 @@
Reeder). Reeder).
- TW-1626 Wrong wait date (thanks to Andrea Rizzi). - TW-1626 Wrong wait date (thanks to Andrea Rizzi).
- TW-1632 Japanese translation for Taskwarrior(150713) (thanks to ribbon). - TW-1632 Japanese translation for Taskwarrior(150713) (thanks to ribbon).
- TW-1634 due.not:<date> excludes only tasks scheduled at mitnight (thanks to
Tomas Babej).
- Prevent potential task duplication during import for non-pending tasks. - Prevent potential task duplication during import for non-pending tasks.
- Show the active context in "context list", if any is active. - Show the active context in "context list", if any is active.
- Fix "task edit" dropping annotation text after newlines. - Fix "task edit" dropping annotation text after newlines.

View file

@ -1157,14 +1157,19 @@ void CLI2::desugarFilterAttributes ()
op.attribute ("raw", "!=="); op.attribute ("raw", "!==");
rhs.attribute ("raw", "''"); rhs.attribute ("raw", "''");
} }
else if (mod == "is" || mod == "equals") else if (mod == "is")
{
op.attribute ("raw", "=");
rhs.attribute ("raw", value);
}
else if (mod == "equals")
{ {
op.attribute ("raw", "=="); op.attribute ("raw", "==");
rhs.attribute ("raw", value); rhs.attribute ("raw", value);
} }
else if (mod == "isnt" || mod == "not") else if (mod == "isnt" || mod == "not")
{ {
op.attribute ("raw", "!=="); op.attribute ("raw", "!=");
rhs.attribute ("raw", value); rhs.attribute ("raw", value);
} }
else if (mod == "has" || mod == "contains") else if (mod == "has" || mod == "contains")

View file

@ -40,44 +40,45 @@ class Test1634(TestCase):
self.t = Task() self.t = Task()
# Setup some tasks due on 2015-07-07 # Setup some tasks due on 2015-07-07
self.t('add due:2015-07-07T00:00:00 on due date 1') self.t('add due:2015-07-07T00:00:00 ON1')
self.t('add due:2015-07-07T08:00:00 on due date 2') self.t('add due:2015-07-07T14:34:56 ON2')
self.t('add due:2015-07-07T14:34:56 on due date 3') self.t('add due:2015-07-07T23:59:59 ON3')
self.t('add due:2015-07-07T22:00:00 on due date 4')
self.t('add due:2015-07-07T23:59:59 on due date 5')
# Setup some tasks not due on 2015-07-07 # Setup some tasks not due on 2015-07-07
self.t('add due:2015-07-06T23:59:59 not on due date 1') self.t('add due:2015-07-06T23:59:59 OFF4')
self.t('add due:2015-07-08T00:00:00 not on due date 2') self.t('add due:2015-07-08T00:00:00 OFF5')
self.t('add due:2015-07-08T00:00:01 not on due date 3') self.t('add due:2015-07-08T00:00:01 OFF6')
self.t('add due:2015-07-06T00:00:00 not on due date 4') self.t('add due:2015-07-06T00:00:00 OFF7')
def test_due_match_not_exact(self): def test_due_match_not_exact(self):
"""Test that due:<date> matches any task that date.""" """Test that due:<date> matches any task that date."""
code, out, err = self.t('due:2015-07-07 minimal') code, out, err = self.t('due:2015-07-07 minimal')
# Assert that each task on 2015-07-07 is listed # Asswer that only tasks ON the date are listed.
for i in range(1,5): self.assertIn("ON1", out)
self.assertIn("on due date {0}".format(i), out) self.assertIn("ON2", out)
self.assertIn("ON3", out)
# Assert that no task not on 2015-07-07 is not listed # Assert that tasks on other dates are not listed.
for i in range(1,4): self.assertNotIn("OFF4", out)
self.assertNotIn("not on due date {0}".format(i), out) self.assertNotIn("OFF5", out)
self.assertNotIn("OFF6", out)
self.assertNotIn("OFF7", out)
def test_due_not_match_not_exact(self): def test_due_not_match_not_exact(self):
"""Test that due.not:<date> does not match any task that date.""" """Test that due.not:<date> does not match any task that date."""
code, out, err = self.t('due.not:2015-07-07 minimal') code, out, err = self.t('due.not:2015-07-07 minimal')
# Assert that every task not on 2015-07-07 is listed # Assert that task ON the date are not listed.
for i in range(1,4): self.assertNotIn("ON1", out)
self.assertIn("not on due date {0}".format(i), out) self.assertNotIn("ON2", out)
self.assertNotIn("ON3", out)
# Assert that each task on 2015-07-07 is listed # Assert that tasks on other dates are listed.
for i in range(1,5): self.assertIn("OFF4", out)
self.assertNotIn("on due date {0}".format(i), out) self.assertIn("OFF5", out)
self.assertIn("OFF6", out)
self.assertIn("OFF7", out)
if __name__ == "__main__": if __name__ == "__main__":