def test_task_with_subtasks(self, logfile): for _ in range(6): logfile.readline() file = make_file(logfile.read()) entry, _ = read_entry(file) expected = ("[ ] a task with subtasks\n" "\t[ ] first thing\n" "\tclarification of first thing\n" "\t[ ] second thing\n") assert entry == expected
def test_complement_when_found(self, logfile): expected = ("[ ] a task\n" "[\\] a WIP task\n" "Just some additional clarifications\n" "\n" "[o] a scheduled task [$TOMORROW$]\n" "[ ] a task with subtasks\n" "\t[ ] first thing\n" "\tclarification of first thing\n" "\t[ ] second thing\n" "[x] a done task\n" "\t[x] with\n" "\t[x] subtasks\n" "[ ] another task\n" "[x] also a done task\n" "[-] an invalid task\n" "\n" "NOTES:\n") _, complement = read_entry(logfile) assert complement.read() == expected
def test_complement_when_not_found(self, empty_logfile): _, complement = read_entry(empty_logfile) assert complement.read() == empty_logfile.read()
def test_empty_file(self, empty_logfile): entry, _ = read_entry(empty_logfile) assert entry is None
def test_task(self, logfile): for _ in range(2): logfile.readline() file = make_file(logfile.read()) entry, _ = read_entry(file) assert entry == "[\\] a WIP task\n"
def test_blank_line(self, logfile): for _ in range(4): logfile.readline() file = make_file(logfile.read()) entry, _ = read_entry(file) assert entry == "\n"
def test_text_entry(self, logfile): for _ in range(3): logfile.readline() file = make_file(logfile.read()) entry, _ = read_entry(file) assert entry == "Just some additional clarifications\n"
def test_generic_entry(self, logfile): entry, _ = read_entry(logfile) assert entry == "AGENDA:\n"