当前位置: 首页>>代码示例>>Python>>正文


Python Todo.remove_tag方法代码示例

本文整理汇总了Python中topydo.lib.Todo.Todo.remove_tag方法的典型用法代码示例。如果您正苦于以下问题:Python Todo.remove_tag方法的具体用法?Python Todo.remove_tag怎么用?Python Todo.remove_tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在topydo.lib.Todo.Todo的用法示例。


在下文中一共展示了Todo.remove_tag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: RecurrenceTest

# 需要导入模块: from topydo.lib.Todo import Todo [as 别名]
# 或者: from topydo.lib.Todo.Todo import remove_tag [as 别名]

#.........这里部分代码省略.........

        self.todo.set_tag(config().tag_due(), future.isoformat())
        new_todo = advance_recurring_todo(self.todo, p_strict=True)

        self.assertEqual(new_todo.due_date(), new_due)

    def test_duedate6(self):
        """ Where due date is today. """
        today = date.today()
        new_due = date.today() + timedelta(7)

        self.todo.set_tag(config().tag_due(), today.isoformat())
        new_todo = advance_recurring_todo(self.todo, p_strict=True)

        self.assertEqual(new_todo.due_date(), new_due)

    def test_noduedate1(self):
        new_due = date.today() + timedelta(7)
        new_todo = advance_recurring_todo(self.todo)

        self.assertTrue(new_todo.has_tag(config().tag_due()))
        self.assertEqual(new_todo.due_date(), new_due)

    def test_noduedate2(self):
        new_due = date.today() + timedelta(7)
        new_todo = advance_recurring_todo(self.todo, p_strict=True)

        self.assertTrue(new_todo.has_tag(config().tag_due()))
        self.assertEqual(new_todo.due_date(), new_due)

    def test_startdate1(self):
        """ Start date is before due date. """
        self.todo.set_tag(config().tag_due(), date.today().isoformat())
        yesterday = date.today() - timedelta(1)
        self.todo.set_tag(config().tag_start(), yesterday.isoformat())

        new_start = date.today() + timedelta(6)
        new_todo = advance_recurring_todo(self.todo)

        self.assertEqual(new_todo.start_date(), new_start)

    def test_startdate2(self):
        """ Strict recurrence. Start date is before due date. """
        due = date.today() - timedelta(1)
        self.todo.set_tag(config().tag_due(), date.today().isoformat())
        yesterday = due - timedelta(1)
        # pylint: disable=E1103
        self.todo.set_tag(config().tag_start(), yesterday.isoformat())

        new_start = date.today() + timedelta(5)
        new_todo = advance_recurring_todo(self.todo, p_strict=True)

        self.assertEqual(new_todo.start_date(), new_start)

    def test_startdate3(self):
        """ Start date equals due date. """
        self.todo.set_tag(config().tag_due(), date.today().isoformat())
        self.todo.set_tag(config().tag_start(), date.today().isoformat())

        new_start = date.today() + timedelta(7)
        new_todo = advance_recurring_todo(self.todo)

        self.assertEqual(new_todo.start_date(), new_start)

    def test_strict_recurrence1(self):
        """
        Strict recurrence where due date is in the past, using + notation in
        expression.
        """
        past = date.today() - timedelta(8)
        new_due = date.today() - timedelta(1)

        self.stricttodo.set_tag(config().tag_due(), past.isoformat())
        new_todo = advance_recurring_todo(self.stricttodo, p_strict=True)

        self.assertEqual(new_todo.due_date(), new_due)

    def test_strict_recurrence2(self):
        """
        Strict recurrence where due date is in the future, using + notation in
        expression.
        """
        future = date.today() + timedelta(1)
        new_due = date.today() + timedelta(8)

        self.stricttodo.set_tag(config().tag_due(), future.isoformat())
        new_todo = advance_recurring_todo(self.stricttodo, p_strict=True)

        self.assertEqual(new_todo.due_date(), new_due)

    def test_no_recurrence(self):
        self.todo.remove_tag('rec')
        self.assertRaises(NoRecurrenceException, advance_recurring_todo,
                          self.todo)

    def test_invalid_recurrence(self):
        """ Throw exception when 'rec' tag has an invalid value. """
        self.todo.set_tag('rec', '1')
        self.assertRaises(NoRecurrenceException, advance_recurring_todo,
                          self.todo)
开发者ID:rameshg87,项目名称:topydo,代码行数:104,代码来源:test_recurrence.py


注:本文中的topydo.lib.Todo.Todo.remove_tag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。