How to use the tasklib.local_zone.localize function in tasklib

To help you get started, we’ve selected a few tasklib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tbabej / taskwiki / tests / test_selected.py View on Github external
def execute(self):
        self.command(
            "TaskWikiStart",
            regex="Task \"test task 1\" started.$",
            lines=1)

        for task in self.tasks:
            task.refresh()

        now = local_zone.localize(datetime.now())

        assert self.tasks[0]['status'] == "pending"
        assert self.tasks[1]['status'] == "pending"

        assert (now - self.tasks[0]['start']).total_seconds() < 5
        assert (self.tasks[0]['start'] - now).total_seconds() < 5

        assert self.tasks[1]['start'] == None
github tbabej / taskwiki / tests / test_selected.py View on Github external
def execute(self):
        self.client.normal('1gg')
        self.client.normal('VG')
        self.client.feedkeys(":TaskWikiDone\\")
        self.client.eval('0')  # wait for command completion

        for task in self.tasks:
            task.refresh()

        now = local_zone.localize(datetime.now())

        assert self.tasks[0]['status'] == "completed"
        assert self.tasks[1]['status'] == "completed"

        assert (now - self.tasks[0]['end']).total_seconds() < 5
        assert (self.tasks[0]['end'] - now).total_seconds() < 5

        assert (now - self.tasks[1]['end']).total_seconds() < 5
        assert (self.tasks[1]['end'] - now).total_seconds() < 5
github tbabej / taskwiki / tests / test_vwtask_parsing.py View on Github external
def test_priority_and_due(self):
        self.cache.buffer[0] = "* [ ] Due today !!! (2015-08-08)"
        vwtask = self.VimwikiTask.from_line(self.cache, 0)

        assert vwtask['description'] == u"Due today"
        assert vwtask['priority'] == 'H'
        assert vwtask['due'] == local_zone.localize(datetime(2015,8,8))
        assert vwtask['uuid'] == None
github tbabej / taskwiki / tests / test_selected.py View on Github external
def execute(self):
        today = local_zone.localize(
            datetime.now().replace(hour=0,minute=0,second=0,microsecond=0))

        self.command(
            "TaskWikiMod due:today",
            regex="Modified 1 task.$",
            lines=1)

        for task in self.tasks:
            task.refresh()

        assert self.tasks[0]['due'] == today
        assert self.tasks[1]['due'] == None

        assert self.tasks[0]['status'] == "pending"
        assert self.tasks[1]['status'] == "pending"