本文整理汇总了Python中test.facilities.load_file函数的典型用法代码示例。如果您正苦于以下问题:Python load_file函数的具体用法?Python load_file怎么用?Python load_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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))
示例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))
示例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))
示例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))
示例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))
示例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))
示例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))
示例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)
示例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), "")
示例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), "")
示例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)
示例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)
示例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)
示例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))
示例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))