本文整理汇总了Python中test.facilities.load_file_to_todolist函数的典型用法代码示例。如果您正苦于以下问题:Python load_file_to_todolist函数的具体用法?Python load_file_to_todolist怎么用?Python load_file_to_todolist使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_file_to_todolist函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_group11
def test_group11(self):
config(p_overrides={('sort', 'group_string'): 'project'})
todolist = load_file_to_todolist("test/data/ListCommandGroupTest.txt")
command = ListCommand(["test:test_group1"], todolist, self.out, self.error)
command.execute()
self.assertFalse(todolist.dirty)
self.assertEqual(self.output, """\
Project: A
==========
| 1| +A only test:test_group1
| 3| +A and +B test:test_group1
Project: B
==========
| 3| +A and +B test:test_group1
| 2| +B only test:test_group1
Project: None
=============
| 4| No project test:test_group1
""")
self.assertEqual(self.errors, "")
示例2: test_group8
def test_group8(self):
todolist = load_file_to_todolist("test/data/ListCommandGroupTest.txt")
command = ListCommand(["-x", "-g", "project,desc:context", "test_group8"], todolist, self.out, self.error)
command.execute()
self.assertFalse(todolist.dirty)
self.assertEqual(self.output, """\
Project: A, Context: B
======================
| 15| Inner sort 2 +A @B test:test_group8
Project: A, Context: A
======================
| 14| Inner sort 1 +A @A test:test_group8
Project: B, Context: B
======================
| 17| Inner sort 4 +B @B test:test_group8
Project: B, Context: A
======================
| 16| Inner sort 3 +B @A test:test_group8
""")
示例3: test_contexts1
def test_contexts1(self):
todolist = load_file_to_todolist("test/data/TodoListTest.txt")
command = ListContextCommand([""], todolist, self.out, self.error)
command.execute()
self.assertEqual(self.output, "Context1\nContext2\n")
self.assertFalse(self.errors)
示例4: test_projects2
def test_projects2(self):
todolist = load_file_to_todolist("test/data/TodoListTest.txt")
command = ListProjectCommand(["aaa"], todolist, self.out, self.error)
command.execute()
self.assertEqual(self.output, "Project1\nProject2\n")
self.assertFalse(self.errors)
示例5: test_projects1
def test_projects1(self):
todolist = load_file_to_todolist("test/data/TodoListTest.txt")
command = ListProjectCommand([""], todolist, self.out, self.error)
command.execute()
command.execute_post_archive_actions() # test default implementation of post_archive
self.assertEqual(self.output, "Project1\nProject2\n")
self.assertFalse(self.errors)
示例6: test_sort14
def test_sort14(self):
sorter = Sorter('desc:importance-average')
todolist = load_file_to_todolist('test/data/SorterTest10.txt')
view = todolist.view(sorter, [])
result = load_file('test/data/SorterTest10-result.txt')
self.assertEqual(print_view(view), todolist_to_string(result))
示例7: test_filter07
def test_filter07(self):
""" Tests the dependency filter. """
todolist = load_file_to_todolist('test/data/FilterTest2.txt')
depfilter = Filter.DependencyFilter(todolist)
filtered_todos = depfilter.filter(todolist.todos())
reference = load_file('test/data/FilterTest2-result.txt')
self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference))
示例8: test_list22
def test_list22(self):
""" Handle tag lists with spaces and punctuation."""
config(p_overrides={("ls", "hide_tags"): "p, id"})
self.todolist = load_file_to_todolist("test/data/ListCommandTagTest.txt")
command = ListCommand(["-x"], self.todolist, self.out, self.error)
command.execute()
self.assertFalse(self.todolist.dirty)
self.assertEqual(self.output, "| 1| Foo.\n")
示例9: test_list22
def test_list22(self):
""" Handle tag lists with spaces and punctuation."""
config(p_overrides={('ls', 'hide_tags'): 'p, id'})
self.todolist = load_file_to_todolist('test/data/ListCommandTagTest.txt')
command = ListCommand(["-x"], self.todolist, self.out, self.error)
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertEqual(self.output, '| 1| Foo.\n')
示例10: test_group10
def test_group10(self):
todolist = load_file_to_todolist("test/data/ListCommandGroupTest.txt")
command = ListCommand(["-x", "-g"], todolist, self.out, self.error)
command.execute()
self.assertFalse(todolist.dirty)
self.assertEqual(self.output, "")
self.assertEqual(self.errors, "option -g requires argument\n")
示例11: test_sort16
def test_sort16(self):
"""
Check sort of low priority tasks (D or lower) with non-priority tasks.
"""
sorter = Sorter('desc:importance,desc:prio')
todolist = load_file_to_todolist('test/data/SorterTest12.txt')
view = todolist.view(sorter, [])
result = load_file('test/data/SorterTest12-result.txt')
self.assertEqual(print_view(view), todolist_to_string(result))
示例12: 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")
示例13: test_list46
def test_list46(self, mock_terminal_size):
"""Test basic 'N' parameter with zero height terminal."""
# we still print at least 1 item
mock_terminal_size.return_value = self.terminal_size(100, 0)
self.todolist = load_file_to_todolist("test/data/ListCommand_50_items.txt")
command = ListCommand(["-N"], self.todolist, self.out, self.error)
command.execute()
self.assertEqual(self.output, "| 1| (A) item 1\n")
self.assertEqual(self.errors, "")
示例14: test_sort15
def test_sort15(self):
"""
Test that own importance is used when average turns out to be
lower.
"""
sorter = Sorter('desc:importance-average')
todolist = load_file_to_todolist('test/data/SorterTest11.txt')
view = todolist.view(sorter, [])
result = load_file('test/data/SorterTest11-result.txt')
self.assertEqual(print_view(view), todolist_to_string(result))
示例15: test_list44
def test_list44(self, mock_terminal_size):
"""
Test 'N' parameter with output longer than available terminal lines.
"""
self.todolist = load_file_to_todolist("test/data/ListCommand_50_items.txt")
mock_terminal_size.return_value = self.terminal_size(80, 23)
command = ListCommand(["-N"], self.todolist, self.out, self.error)
command.execute()
self.assertEqual(self.output, "| 1| (A) item 1\n| 27| (A) item 27\n| 2| (B) item 2\n| 28| (B) item 28\n| 3| (C) item 3\n| 29| (C) item 29\n| 4| (D) item 4\n| 30| (D) item 30\n| 5| (E) item 5\n| 31| (E) item 31\n| 6| (F) item 6\n| 32| (F) item 32\n| 7| (G) item 7\n| 33| (G) item 33\n| 8| (H) item 8\n| 34| (H) item 34\n| 9| (I) item 9\n| 35| (I) item 35\n| 10| (J) item 10\n| 36| (J) item 36\n| 11| (K) item 11\n")
self.assertEqual(self.errors, "")