本文整理汇总了Python中test.facilities.load_file函数的典型用法代码示例。如果您正苦于以下问题:Python load_file函数的具体用法?Python load_file怎么用?Python load_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_file函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_filter31
def test_filter31(self):
todos = load_file('test/data/FilterTest3.txt')
otf = Filter.OrdinalTagFilter('value:>-8')
filtered_todos = otf.filter(todos)
reference = load_file('test/data/FilterTest13-result.txt')
self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference))
开发者ID:rcraggs,项目名称:topydo,代码行数:9,代码来源:test_filter.py
示例2: test_filter16
def test_filter16(self):
todos = load_file('test/data/FilterTest1.txt')
grep = Filter.NegationFilter(Filter.GrepFilter('+project'))
filtered_todos = grep.filter(todos)
reference = load_file('test/data/FilterTest3-result.txt')
self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference))
开发者ID:rcraggs,项目名称:topydo,代码行数:9,代码来源:test_filter.py
示例3: test_filter20
def test_filter20(self):
todos = load_file('test/data/FilterTest3.txt')
otf = Filter.OrdinalTagFilter('due:<2014-11-10')
filtered_todos = otf.filter(todos)
reference = load_file('test/data/FilterTest6-result.txt')
self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference))
开发者ID:rcraggs,项目名称:topydo,代码行数:9,代码来源:test_filter.py
示例4: test_filter08
def test_filter08(self):
""" Test case sensitive match (forced, with lowercase). """
todos = load_file('test/data/FilterTest1.txt')
grep = Filter.GrepFilter('+Project', False)
filtered_todos = grep.filter(todos)
reference = load_file('test/data/FilterTest1a-result.txt')
self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference))
开发者ID:rcraggs,项目名称:topydo,代码行数:10,代码来源:test_filter.py
示例5: test_filter05
def test_filter05(self):
""" Test case sensitive match. """
todos = load_file('test/data/FilterTest1.txt')
grep = Filter.GrepFilter('+Project')
filtered_todos = grep.filter(todos)
reference = load_file('test/data/FilterTest1b-result.txt')
self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference))
开发者ID:rcraggs,项目名称:topydo,代码行数:10,代码来源:test_filter.py
示例6: test_filter18
def test_filter18(self):
todos = load_file('test/data/FilterTest1.txt')
grep1 = Filter.GrepFilter('part')
grep2 = Filter.GrepFilter('important')
grep = Filter.OrFilter(grep1, grep2)
filtered_todos = grep.filter(todos)
reference = load_file('test/data/FilterTest5-result.txt')
self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference))
开发者ID:rcraggs,项目名称:topydo,代码行数:11,代码来源:test_filter.py
示例7: test_filter17
def test_filter17(self):
todos = load_file('test/data/FilterTest1.txt')
grep1 = Filter.GrepFilter('task')
grep2 = Filter.GrepFilter('project')
andfilter = Filter.AndFilter(grep1, grep2)
filtered_todos = andfilter.filter(todos)
reference = load_file('test/data/FilterTest4-result.txt')
self.assertEqual(todolist_to_string(filtered_todos),
todolist_to_string(reference))
开发者ID:rcraggs,项目名称:topydo,代码行数:11,代码来源:test_filter.py
示例8: sort_file
def sort_file(self, p_filename, p_filename_ref, p_sorter):
"""
Sorts a file and compares it with a reference result.
Also check that the sort algorithm hasn't touched the original data.
"""
todos = load_file(p_filename)
text_before = todolist_to_string(todos)
todos_sorted = todolist_to_string(p_sorter.sort(todos))
todos_ref = todolist_to_string(load_file(p_filename_ref))
self.assertEqual(todos_sorted, todos_ref)
self.assertEqual(todolist_to_string(todos), text_before)
开发者ID:rameshg87,项目名称:topydo,代码行数:12,代码来源:test_sorter.py
示例9: test_filter23
def test_filter23(self):
todos = load_file('test/data/FilterTest3.txt')
otf = Filter.OrdinalTagFilter('due:=2014-11-99')
filtered_todos = otf.filter(todos)
self.assertEqual(todolist_to_string(filtered_todos), "")
开发者ID:rcraggs,项目名称:topydo,代码行数:7,代码来源:test_filter.py
示例10: test_filter28
def test_filter28(self):
todos = load_file('test/data/FilterTest3.txt')
otf = Filter.OrdinalTagFilter('value:<16a')
filtered_todos = otf.filter(todos)
self.assertEqual(todolist_to_string(filtered_todos), "")
开发者ID:rcraggs,项目名称:topydo,代码行数:7,代码来源:test_filter.py
示例11: test_filter09
def test_filter09(self):
""" Test instance filter. """
todos = load_file('test/data/FilterTest1.txt')
instance_filter = Filter.InstanceFilter(todos[2:])
filtered_todos = instance_filter.filter(todos)
self.assertEqual(todos[2:], filtered_todos)
开发者ID:rcraggs,项目名称:topydo,代码行数:8,代码来源:test_filter.py
示例12: test_filter15
def test_filter15(self):
""" Test limit filter. """
todos = load_file('test/data/FilterTest1.txt')
limit_filter = Filter.LimitFilter(100)
filtered_todos = limit_filter.filter(todos)
self.assertEqual(len(filtered_todos), 4)
开发者ID:rcraggs,项目名称:topydo,代码行数:8,代码来源:test_filter.py
示例13: test_filter14
def test_filter14(self):
""" Test limit filter. """
todos = load_file('test/data/FilterTest1.txt')
limit_filter = Filter.LimitFilter(-1)
filtered_todos = limit_filter.filter(todos)
self.assertEqual(todos, filtered_todos)
开发者ID:rcraggs,项目名称:topydo,代码行数:8,代码来源:test_filter.py
示例14: 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))
开发者ID:rameshg87,项目名称:topydo,代码行数:8,代码来源:test_sorter.py
示例15: 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))
开发者ID:rcraggs,项目名称:topydo,代码行数:10,代码来源:test_filter.py
示例16: test_filter13
def test_filter13(self):
""" Test limit filter. """
todos = load_file('test/data/FilterTest1.txt')
limit_filter = Filter.LimitFilter(1)
filtered_todos = limit_filter.filter(todos)
self.assertEqual(len(filtered_todos), 1)
self.assertEqual(filtered_todos[0].source(),
'(C) This is part of some +Project')
开发者ID:rcraggs,项目名称:topydo,代码行数:10,代码来源:test_filter.py
示例17: 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
示例18: 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))
开发者ID:rameshg87,项目名称:topydo,代码行数:11,代码来源:test_sorter.py
示例19: 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))
开发者ID:rameshg87,项目名称:topydo,代码行数:12,代码来源:test_sorter.py
示例20: test_empty_file
def test_empty_file(self):
todofile = load_file('test/data/TodoFileTest1.txt')
self.assertEqual(len(todofile), 0)
开发者ID:MinchinWeb,项目名称:topydo,代码行数:4,代码来源:test_todo_file.py
注:本文中的test.facilities.load_file函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论