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


Python TodoList.TodoList类代码示例

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


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

示例1: test_todo_by_dep_id

    def test_todo_by_dep_id(self):
        """ Tests that todos can be retrieved by their id tag. """
        todolist = TodoList([])
        todolist.add("(C) Foo id:1")

        self.assertTrue(todolist.todo_by_dep_id("1"))
        self.assertFalse(todolist.todo_by_dep_id("2"))
开发者ID:netimen,项目名称:topydo,代码行数:7,代码来源:TodoListTest.py

示例2: test_view

    def test_view(self):
        """ Check filters and printer for views. """
        todofile = TodoFile('test/data/FilterTest1.txt')
        ref = load_file('test/data/ViewTest1-result.txt')

        todolist = TodoList(todofile.read())
        sorter = Sorter('text')
        todofilter = Filter.GrepFilter('+Project')
        view = todolist.view(sorter, [todofilter])

        self.assertEqual(print_view(view), todolist_to_string(ref))
开发者ID:rameshg87,项目名称:topydo,代码行数:11,代码来源:test_view.py

示例3: test_progress30

    def test_progress30(self):
        """ Progress color determined by parent """
        todolist = TodoList([
            "Foo id:1",
            "Bar p:1",
        ])

        color = progress_color(todolist.todo(2))

        # the parent has no influence here
        self.assertEqual(color.color, 2)
开发者ID:MinchinWeb,项目名称:topydo,代码行数:11,代码来源:test_progress_color.py

示例4: test_progress29

    def test_progress29(self):
        """ Progress color determined by parent """
        todolist = TodoList([
            "Overdue id:1 due:2015-12-31",
            "Bar p:1 t:2016-01-01 due:2016-01-01",
        ])

        color = progress_color(todolist.todo(2))

        # the parent has no influence here
        self.assertEqual(color.color, 3)
开发者ID:MinchinWeb,项目名称:topydo,代码行数:11,代码来源:test_progress_color.py

示例5: test_archive

    def test_archive(self):
        todolist = load_file_to_todolist("test/data/ArchiveCommandTest.txt")
        archive = TodoList([])

        command = ArchiveCommand(todolist, archive)
        command.execute()

        self.assertTrue(todolist.is_dirty())
        self.assertTrue(archive.is_dirty())
        self.assertEqual(todolist.print_todos(), "x Not complete\n(C) Active")
        self.assertEqual(archive.print_todos(), "x 2014-10-19 Complete\nx 2014-10-20 Another one complete")
开发者ID:netimen,项目名称:topydo,代码行数:11,代码来源:ArchiveCommandTest.py

示例6: test_progress28

    def test_progress28(self):
        """ Progress color determined by parent """
        todolist = TodoList([
            "Overdue id:1 due:2015-12-31",
            "Bar p:1",
        ])

        color = progress_color(todolist.todo(2))

        # color the subitem red because it has no color of its own and its
        # parent is overdue
        self.assertEqual(color.color, 1)
开发者ID:MinchinWeb,项目名称:topydo,代码行数:12,代码来源:test_progress_color.py

示例7: get_backup

    def get_backup(self, p_todolist):
        """
        Retrieves a backup for p_todolist from backup file and sets todolist,
        archive and call attributes to appropriate data from it.
        """
        change_hash = hash_todolist(p_todolist)

        index = self._get_index()
        self.timestamp = index[[change[1] for change in index].index(change_hash)][0]

        d = self.backup_dict[self.timestamp]

        self.todolist = TodoList(d[0])
        self.archive = TodoList(d[1])
        self.call = d[2]
开发者ID:MinchinWeb,项目名称:topydo,代码行数:15,代码来源:ChangeSet.py

示例8: setUp

    def setUp(self):
        super(TodoListCleanDependencyTester, self).setUp()

        self.todolist = TodoList([])
        self.todolist.add("Bar p:1")
        self.todolist.add("Baz p:1 id:2")
        self.todolist.add("Buzz p:2")
开发者ID:netimen,项目名称:topydo,代码行数:7,代码来源:TodoListTest.py

示例9: setUp

    def setUp(self):
        super().setUp()
        todos = [
            "Foo id:1",
            "Bar p:1 @test",
            "Baz @test",
            u"Fo\u00f3B\u0105\u017a",
        ]

        self.todolist = TodoList(todos)
开发者ID:bram85,项目名称:topydo,代码行数:10,代码来源:test_edit_command.py

示例10: setUp

    def setUp(self):
        super().setUp()
        todos = [
            "Foo",
            "Bar due:2014-10-22",
            "Baz due:2014-10-20",
            "Fnord due:2014-10-20 due:2014-10-22",
        ]

        self.todolist = TodoList(todos)
开发者ID:MinchinWeb,项目名称:topydo,代码行数:10,代码来源:test_tag_command.py

示例11: setUp

    def setUp(self):
        super(PriorityCommandTest, self).setUp()
        todos = [
            "(A) Foo",
            "Bar",
            "(B) a @test with due:2015-06-03",
            "a @test with +project p:1",
            "Baz id:1",
        ]

        self.todolist = TodoList(todos)
开发者ID:netimen,项目名称:topydo,代码行数:11,代码来源:PriorityCommandTest.py

示例12: setUp

    def setUp(self):
        super().setUp()
        todos = [
            "(A) Foo",
            "Bar",
            "(B) Baz",
            "(E) a @test with due:2015-06-03",
            "(Z) a @test with +project p:1",
            "(D) Bax id:1",
        ]

        self.todolist = TodoList(todos)
开发者ID:bram85,项目名称:topydo,代码行数:12,代码来源:test_depri_command.py

示例13: setUp

    def setUp(self):
        super().setUp()
        todos = [
            "Foo",
            "Bar",
            "Baz",
        ]

        self.todolist = TodoList(todos)
        self.today = date.today()

        self.tmp_name = str(uuid4().hex.upper()[0:6])

        archive_filename = tempfile.gettempdir() + os.sep + self.tmp_name + '_archive'
        todo_filename = tempfile.gettempdir() + os.sep + self.tmp_name + '_todo'

        config(p_overrides={('topydo', 'archive_filename'): archive_filename,
            ('topydo', 'filename'): todo_filename, ('topydo', 'backup_count'): '5'})

        self.archive_file = TodoFile(archive_filename)
        self.archive = TodoList([])
开发者ID:rcraggs,项目名称:topydo,代码行数:21,代码来源:test_revert_command.py

示例14: setUp

    def setUp(self):
        super(PostponeCommandTest, self).setUp()
        self.today = date.today()
        self.past = date.today() - timedelta(1)
        self.future = date.today() + timedelta(1)
        self.start = date.today() - timedelta(2)
        self.future_start = self.future - timedelta(2)

        todos = [
            "Foo",
            "Bar due:{}".format(self.today.isoformat()),
            "Baz due:{} t:{}".format(self.today.isoformat(), self.start.isoformat()),
            "Past due:{}".format(self.past.isoformat()),
            "Future due:{} t:{}".format(self.future.isoformat(), self.future_start.isoformat()),
            "FutureStart t:{}".format(self.future.isoformat())
        ]

        self.todolist = TodoList(todos)
开发者ID:netimen,项目名称:topydo,代码行数:18,代码来源:PostponeCommandTest.py

示例15: setUp

    def setUp(self):
        super().setUp()
        todos = [
            "Foo id:1",
            "Bar p:1",
            "Baz p:1",
            "Recurring! rec:1d",
            "x 2014-10-18 Already complete",
            "Inactive t:2030-12-31 id:2",
            "Subtodo of inactive p:2",
            "Strict due:2014-01-01 rec:1d",
            "Invalid rec:1",
            "a @test with due:2015-06-03",
            "a @test with +project",
        ]

        self.todolist = TodoList(todos)
        self.today = date.today()
        self.tomorrow = self.today + timedelta(1)
        self.yesterday = self.today - timedelta(1)

        self.yesterday = self.yesterday.isoformat()
        self.today = self.today.isoformat()
        self.tomorrow = self.tomorrow.isoformat()
开发者ID:rcraggs,项目名称:topydo,代码行数:24,代码来源:test_do_command.py


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