add initial bulk run from pre-commit over all files

This commit is contained in:
Felix Schurk 2024-07-29 22:34:51 +02:00
parent 665aeeef61
commit 93356b39c3
418 changed files with 21354 additions and 23858 deletions

View file

@ -45,7 +45,7 @@ DATETIME_FORMAT = "%Y%m%dT%H%M%SZ"
class TestExportCommand(TestCase):
def setUp(self):
self.t = Task()
self.t('add test')
self.t("add test")
def export(self, id):
code, out, err = self.t(("{0}".format(id), "rc.json.array=off", "export"))
@ -91,62 +91,62 @@ class TestExportCommand(TestCase):
self.assertEqual(value, expected_value)
def test_export_status(self):
self.assertString(self.export(1)['status'], "pending")
self.assertString(self.export(1)["status"], "pending")
def test_export_uuid(self):
self.assertString(self.export(1)['uuid'], UUID_REGEXP, regexp=True)
self.assertString(self.export(1)["uuid"], UUID_REGEXP, regexp=True)
def test_export_entry(self):
self.assertTimestamp(self.export(1)['entry'])
self.assertTimestamp(self.export(1)["entry"])
def test_export_description(self):
self.assertString(self.export(1)['description'], "test")
self.assertString(self.export(1)["description"], "test")
def test_export_start(self):
self.t('1 start')
self.assertTimestamp(self.export(1)['start'])
self.t("1 start")
self.assertTimestamp(self.export(1)["start"])
def test_export_end(self):
self.t('1 start')
self.t("1 start")
self.t.faketime("+5s")
# After a task is "done" or "deleted", it does not have an ID by which
# to filter it anymore. Add a tag to work around this.
self.t('1 done +workaround')
self.assertTimestamp(self.export('+workaround')['end'])
self.t("1 done +workaround")
self.assertTimestamp(self.export("+workaround")["end"])
def test_export_due(self):
self.t('1 modify due:today')
self.assertTimestamp(self.export(1)['due'])
self.t("1 modify due:today")
self.assertTimestamp(self.export(1)["due"])
def test_export_wait(self):
self.t('1 modify wait:tomorrow')
self.assertTimestamp(self.export(1)['wait'])
self.t("1 modify wait:tomorrow")
self.assertTimestamp(self.export(1)["wait"])
def test_export_modified(self):
self.assertTimestamp(self.export(1)['modified'])
self.assertTimestamp(self.export(1)["modified"])
def test_export_scheduled(self):
self.t('1 modify schedule:tomorrow')
self.assertTimestamp(self.export(1)['scheduled'])
self.t("1 modify schedule:tomorrow")
self.assertTimestamp(self.export(1)["scheduled"])
def test_export_recur(self):
self.t('1 modify recur:daily due:today')
self.assertString(self.export(1)['recur'], "daily")
self.t("1 modify recur:daily due:today")
self.assertString(self.export(1)["recur"], "daily")
def test_export_project(self):
self.t('1 modify project:Home')
self.assertString(self.export(1)['project'], "Home")
self.t("1 modify project:Home")
self.assertString(self.export(1)["project"], "Home")
def test_export_priority(self):
self.t('1 modify priority:H')
self.assertString(self.export(1)['priority'], "H")
self.t("1 modify priority:H")
self.assertString(self.export(1)["priority"], "H")
def test_export_depends(self):
self.t(('add', 'everything depends on me task'))
self.t(('add', 'wrong, everything depends on me task'))
self.t('1 modify depends:2,3')
self.t(("add", "everything depends on me task"))
self.t(("add", "wrong, everything depends on me task"))
self.t("1 modify depends:2,3")
deps = self.export(1)['depends']
deps = self.export(1)["depends"]
self.assertType(deps, list)
self.assertEqual(len(deps), 2)
@ -154,30 +154,30 @@ class TestExportCommand(TestCase):
self.assertString(uuid, UUID_REGEXP, regexp=True)
def test_export_urgency(self):
self.t('add urgent task +urgent')
self.t("add urgent task +urgent")
# Urgency can be either integer or float
self.assertNumeric(self.export(1)['urgency'])
self.assertNumeric(self.export(1)["urgency"])
def test_export_numeric_uda(self):
self.t.config('uda.estimate.type', 'numeric')
self.t('add estimate:42 test numeric uda')
self.assertNumeric(self.export('2')['estimate'], 42)
self.t.config("uda.estimate.type", "numeric")
self.t("add estimate:42 test numeric uda")
self.assertNumeric(self.export("2")["estimate"], 42)
def test_export_string_uda(self):
self.t.config('uda.estimate.type', 'string')
self.t('add estimate:big test string uda')
self.assertString(self.export('2')['estimate'], 'big')
self.t.config("uda.estimate.type", "string")
self.t("add estimate:big test string uda")
self.assertString(self.export("2")["estimate"], "big")
def test_export_datetime_uda(self):
self.t.config('uda.estimate.type', 'date')
self.t('add estimate:eom test date uda')
self.assertTimestamp(self.export('2')['estimate'])
self.t.config("uda.estimate.type", "date")
self.t("add estimate:eom test date uda")
self.assertTimestamp(self.export("2")["estimate"])
def test_export_duration_uda(self):
self.t.config('uda.estimate.type', 'duration')
self.t('add estimate:month test duration uda')
self.assertString(self.export('2')['estimate'], 'P30D')
self.t.config("uda.estimate.type", "duration")
self.t("add estimate:month test duration uda")
self.assertString(self.export("2")["estimate"], "P30D")
class TestExportCommandLimit(TestCase):
@ -186,8 +186,8 @@ class TestExportCommandLimit(TestCase):
def test_export_obeys_limit(self):
"""Verify that 'task export limit:1' is obeyed"""
self.t('add one')
self.t('add two')
self.t("add one")
self.t("add two")
code, out, err = self.t("/o/ limit:1 export")
self.assertIn("one", out)
@ -196,6 +196,7 @@ class TestExportCommandLimit(TestCase):
if __name__ == "__main__":
from simpletap import TAPTestRunner
unittest.main(testRunner=TAPTestRunner())
# vim: ai sts=4 et sw=4 ft=python