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


Python TodoBase.TodoBase类代码示例

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


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

示例1: test_set_priority6

    def test_set_priority6(self):
        """ Do not set priorities on completed tasks. """
        todo = TodoBase("x 2014-06-13 Foo")
        todo.set_priority('A')

        self.assertFalse(todo.priority())
        self.assertEqual(todo.src, "x 2014-06-13 Foo")
开发者ID:netimen,项目名称:topydo,代码行数:7,代码来源:TodoBaseTest.py

示例2: test_set_priority2

    def test_set_priority2(self):
        """ Set priority to task without priority. """
        todo = TodoBase("Foo")
        todo.set_priority('B')

        self.assertEqual(todo.priority(), 'B')
        self.assertTrue(re.match(r'^\(B\) Foo$', todo.src))
开发者ID:netimen,项目名称:topydo,代码行数:7,代码来源:TodoBaseTest.py

示例3: test_set_priority5

    def test_set_priority5(self):
        """ Unset priority. """
        todo = TodoBase("(A) Foo")
        todo.set_priority(None)

        self.assertEqual(todo.priority(), None)
        self.assertTrue(re.match(r'^Foo$', todo.src))
开发者ID:netimen,项目名称:topydo,代码行数:7,代码来源:TodoBaseTest.py

示例4: test_set_priority3

    def test_set_priority3(self):
        """ Test invalid priority input. """
        todo = TodoBase("(A) Foo")
        todo.set_priority('AB')

        self.assertEqual(todo.priority(), 'A')
        self.assertTrue(re.match(r'^\(A\) Foo$', todo.src))
开发者ID:netimen,项目名称:topydo,代码行数:7,代码来源:TodoBaseTest.py

示例5: test_remove_all

    def test_remove_all(self):
        todo = TodoBase("(C) Foo foo:bar foo:baz foo:")
        todo.remove_tag('foo')

        self.assertFalse(todo.has_tag('foo'))
        self.assertFalse(re.search(r'\bfoo:(bar|baz)\b', todo.src))
        self.assertTrue(re.search(r'foo:', todo.src))
开发者ID:netimen,项目名称:topydo,代码行数:7,代码来源:TodoBaseTest.py

示例6: test_set_priority1

    def test_set_priority1(self):
        """ Change priority. """
        todo = TodoBase("(A) Foo")
        todo.set_priority('B')

        self.assertEqual(todo.priority(), 'B')
        self.assertTrue(re.match(r'^\(B\) Foo$', todo.src))
开发者ID:netimen,项目名称:topydo,代码行数:7,代码来源:TodoBaseTest.py

示例7: test_set_tag_double_tag

    def test_set_tag_double_tag(self):
        todo = TodoBase("(C) Foo foo:bar foo:baz")
        todo.set_tag('foo', 'blah')

        self.assertTrue(todo.has_tag('foo', 'blah'))
        self.assertTrue(todo.has_tag('foo', 'bar') or
                        todo.has_tag('foo', 'baz'))
开发者ID:rameshg87,项目名称:topydo,代码行数:7,代码来源:test_todo_base.py

示例8: test_set_creation_date7

 def test_set_creation_date7(self):
     """
     A todo item with an invalid creation date is not considered to have
     one.
     """
     todo = TodoBase("x 2017-07-01 2017-06-31 Invalid")
     self.assertIsNone(todo.creation_date())
开发者ID:bram85,项目名称:topydo,代码行数:7,代码来源:test_todo_base.py

示例9: test_set_source_text

    def test_set_source_text(self):
        todo = TodoBase("(B) Foo")

        new_text = "(C) Foo"
        todo.set_source_text(new_text)

        self.assertEqual(todo.src, new_text)
        self.assertEqual(todo.priority(),'C')
开发者ID:netimen,项目名称:topydo,代码行数:8,代码来源:TodoBaseTest.py

示例10: test_set_creation_date5

    def test_set_creation_date5(self):
        todo = TodoBase("x 2014-07-25 2014-07-23 Foo")
        creation_date = date(2014, 7, 24)

        todo.set_creation_date(creation_date)

        self.assertEqual(todo.creation_date(), creation_date)
        self.assertEqual(todo.src, "x 2014-07-25 2014-07-24 Foo")
开发者ID:netimen,项目名称:topydo,代码行数:8,代码来源:TodoBaseTest.py

示例11: test_set_complete4

    def test_set_complete4(self):
        todo = TodoBase("(A) 2014-06-12 Foo")
        todo.set_completed()

        today = date.today()
        today_str = today.isoformat()

        self.assertEqual(todo.fields['completionDate'], today)
        self.assertTrue(re.match('^x ' + today_str + ' 2014-06-12 Foo', todo.src))
开发者ID:netimen,项目名称:topydo,代码行数:9,代码来源:TodoBaseTest.py

示例12: test_completion5

    def test_completion5(self):
        """
        A todo item with an invalid completion date is still considered as
        completed, but without a creation date.
        """
        todo = TodoBase("x 2017-06-31 Invalid date")

        self.assertTrue(todo.is_completed())
        self.assertIsNone(todo.completion_date())
开发者ID:bram85,项目名称:topydo,代码行数:9,代码来源:test_todo_base.py

示例13: test_set_complete1

    def test_set_complete1(self):
        todo = TodoBase("(A) Foo")
        todo.set_completed()

        today = date.today()
        today_str = today.isoformat()

        self.assertFalse(todo.priority())
        self.assertEqual(todo.fields['completionDate'], today)
        self.assertTrue(re.match('^x ' + today_str + ' Foo', todo.src))
开发者ID:netimen,项目名称:topydo,代码行数:10,代码来源:TodoBaseTest.py

示例14: test_set_priority4

    def test_set_priority4(self):
        """ Add priority, while not be mistaken about todo string. """
        todo = TodoBase("(A)Foo")

        self.assertNotEqual(todo.priority(), 'A')

        todo.set_priority('B')

        self.assertEqual(todo.priority(), 'B')
        self.assertTrue(re.match(r'^\(B\) \(A\)Foo$', todo.src))
开发者ID:netimen,项目名称:topydo,代码行数:10,代码来源:TodoBaseTest.py

示例15: test_set_tag_double_value

    def test_set_tag_double_value(self):
        todo = TodoBase("(C) Foo foo:bar baz:bar")
        todo.set_tag('foo', 'blah');

        self.assertTrue(todo.has_tag('foo'))
        self.assertTrue(todo.tag_value('foo'), 'blah')
        self.assertTrue(todo.has_tag('baz'))
        self.assertTrue(todo.tag_value('baz'), 'bar')
开发者ID:netimen,项目名称:topydo,代码行数:8,代码来源:TodoBaseTest.py


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