def test_entries_and_negation_equals_original(self, tasklist_file): entries = get_entries(tasklist_file, of_type=is_undone_task) entries_string = "".join(entries) entries_negation = get_entries(tasklist_file, of_type=lambda x: not is_undone_task(x)) entries_negation_string = "".join(entries_negation) assert len(entries_string + entries_negation_string) == len( tasklist_file.read())
def test_some_entries(self, tasklist_file): entries = get_entries(tasklist_file, of_type=is_undone_task) entries_string = "".join(entries) expected = ("[ ] a task\n" "[ ] a task with subtasks\n" "\t[\\] first thing\n" "\tclarification of first thing\n" "\t[ ] second thing\n" "[ ] another task\n") assert entries_string == expected
def test_some_entries_negation(self, tasklist_file): entries = get_entries(tasklist_file, of_type=lambda x: not is_undone_task(x)) entries_string = "".join(entries) expected = ("TOMORROW:\n" "Just some additional clarifications\n" "\n" "[\\] a WIP task\n" "[o] a scheduled task [$TOMORROW$]\n" "THIS WEEK:\n" "THIS MONTH:\n" "THIS QUARTER:\n" "THIS YEAR:\n" "SOMEDAY:\n") assert entries_string == expected
def test_empty_file(self, empty_logfile): entries = get_entries(empty_logfile) entries_string = "".join(entries) assert entries_string == ""
def test_all_matching_entries(self, tasklist_file): entries = get_entries(tasklist_file, of_type=lambda x: not is_done_task(x)) entries_string = "".join(entries) assert entries_string == tasklist_file.read()
def test_no_matching_entries(self, tasklist_file): entries = get_entries(tasklist_file, of_type=is_done_task) entries_string = "".join(entries) assert entries_string == ""
def test_no_entries(self, tasklist_file): entries = get_entries(tasklist_file, of_type=lambda x: False) entries_string = "".join(entries) assert entries_string == ""
def test_all_entries(self, tasklist_file): entries = get_entries(tasklist_file) entries_string = "".join(entries) assert entries_string == tasklist_file.read()