def test_completed_date_setter_exception(self): todo_entry = TodoEntry( '(A) Make @Cute +T1 +T2 c1:c2 c3:c4 with c-c-c-c-c') with self.assertRaises(ValueError) as cm: todo_entry.completed_date = '2017-01-01' self.assertEqual(cm.exception.args[0], "Please, complete todo entry first") todo_entry.completed = True with self.assertRaises(ValueError) as cm: todo_entry.completed_date = '2017-01-01' self.assertEqual(cm.exception.args[0], "Cannot set completed_date without created_date")
def test_completed_date_setter_positive(initial_entry, result_entry, completed_date_value): todo_entry = TodoEntry(initial_entry) todo_entry.completed_date = completed_date_value assert str(todo_entry) == result_entry