def test_line_number_and_filename(self): """Test that the line number and filename are added if line_number is true and reference is always.""" self.namespace.reference = "always" self.namespace.line_number = True self.assertEqual( f"{self.call_mom.text} [{self.filename1}:{self.line_number1}]", render_next_action([self.call_mom], [], self.namespace))
def test_blocked(self): """Test that the blocked task is rendered.""" self.namespace.blocked = True rinse = todotxt.Task("Rinse before:repeat") rinse.add_blocked_task(self.repeat) self.assertEqual(f"Rinse before:repeat\nblocks:\n- {self.repeat.text}", render_next_action([rinse], [], self.namespace))
def test_reference_multiple(self): """Test that the source filename is added if reference is multiple and there are multiple todo.txt files.""" self.namespace.file.append("work.txt") self.assertEqual( f"{self.call_mom.text} [{self.filename1}]\nProposal [{self.filename2}]", render_next_action( [self.call_mom, todotxt.Task("Proposal", self.filename2)], [], self.namespace))
def test_reference_never(self): """Test that the source filename is not added if reference is never.""" self.namespace.reference = "never" self.namespace.file.append(self.filename2) self.assertEqual( f"{self.call_mom.text}\nProposal", render_next_action( [self.call_mom, todotxt.Task("Proposal", self.filename2)], [], self.namespace))
def test_blocked_recursive(self): """Test that the blocked tasks are rendered, recursively.""" self.namespace.blocked = True lather = todotxt.Task("Lather before:rinse") rinse = todotxt.Task("Rinse id:rinse before:repeat") lather.add_blocked_task(rinse) rinse.add_blocked_task(self.repeat) self.assertEqual( f"Lather before:rinse\nblocks:\n- Rinse id:rinse before:repeat\n blocks:\n - {self.repeat.text}", render_next_action([lather], [], self.namespace))
def test_blocked_multiple(self): """Test that multiple blocked tasks are rendered.""" self.namespace.blocked = True lather = todotxt.Task("Rinse before:repeat before:rinse") rinse = todotxt.Task("Rinse id:rinse") lather.add_blocked_task(self.repeat) lather.add_blocked_task(rinse) self.assertEqual( f"Rinse before:repeat before:rinse\nblocks:\n- {self.repeat.text}\n- Rinse id:rinse", render_next_action([lather], [], self.namespace))
def test_reference_always(self): """Test that the source filename is added if reference is always.""" self.namespace.reference = "always" self.assertEqual( f"{self.call_mom.text} [{self.filename1}]", render_next_action([self.call_mom], [], self.namespace))
def test_line_number(self): """Test that the line number is added if line_number is true.""" self.namespace.line_number = True self.assertEqual( f"{self.call_mom.text} [{self.line_number1}]", render_next_action([self.call_mom], [], self.namespace))