Пример #1
0
 def test_toggle_sub_todo(self):
     """Toggling subs with 'todo' arg changes all completed to True."""
     self.task.subs = [classes.Sub('sub', 1, completed=True),
                       classes.Sub('sub1', 2, completed=True)]
     self.task.toggle_sub('todo')
     self.assertEqual(self.task.subs[0].completed, False)
     self.assertEqual(self.task.subs[1].completed, False)
Пример #2
0
 def test_auto_percentage_subs_all_done(self):
     """Auto percentage return when all of the subs are completed."""
     self.goal.subs = [
         classes.Sub('Sub1', 1, completed=True),
         classes.Sub('Sub2', 2, completed=True)
     ]
     self.assertEqual(self.goal.auto_percentage(), 100)
Пример #3
0
 def test_toggle_sub_done_argless(self, mock_get_input):
     """Toggling subs with 'done' prompt changes all completed to True."""
     self.task.subs = [classes.Sub('sub', 1), classes.Sub('sub1', 2)]
     mock_get_input.return_value = 'done'
     self.task.toggle_sub()
     self.assertEqual(self.task.subs[0].completed, True)
     self.assertEqual(self.task.subs[1].completed, True)
Пример #4
0
 def test_move_subgoal(self):
     """Move given Goal.goals with 2 spaced ints moves Subgoal correctly."""
     classes.Goal.goals[0].subs = [
         classes.Sub('Sub1', 1),
         classes.Sub('Sub2', 2)
     ]
     todoian.move_item('1 2 1', classes.Goal.goals)
     self.assertEqual(classes.Goal.goals[0].subs[0].title, 'Sub2')
Пример #5
0
 def test_move_subtask(self):
     """Move given Task.tasks with 3 spaced ints moves Subtask correctly."""
     classes.Task.tasks[0].subs = [
         classes.Sub('Sub1', 1),
         classes.Sub('Sub2', 2)
     ]
     todoian.move_item('1 2 1', classes.Task.tasks)
     self.assertEqual(classes.Task.tasks[0].subs[0].title, 'Sub2')
Пример #6
0
 def test_toggle_sub_todo_argless(self, mock_get_input):
     """Toggling subs with 'todo' makes all completed attributes False."""
     self.task.subs = [classes.Sub('sub', 1, completed=True),
                       classes.Sub('sub1', 2, completed=True)]
     mock_get_input.return_value = 'todo'
     self.task.toggle_sub()
     self.assertEqual(self.task.subs[0].completed, False)
     self.assertEqual(self.task.subs[1].completed, False)
Пример #7
0
 def test_remove_sub(self):
     """Removing a sub of a Task via argument modifies subs correctly."""
     self.task.subs = [classes.Sub('sub', 1), classes.Sub('sub2', 2)]
     self.task.remove_sub(1)
     self.assertTrue(len(self.task.subs) == 1)
     self.assertTrue(self.task.subs[0].title == 'sub2')
Пример #8
0
 def test_remove_sub_all(self):
     """Removing all subs of a Task via argument modifies subs correctly."""
     self.task.subs = [classes.Sub('sub', 1), classes.Sub('sub2', 2)]
     self.task.remove_sub('all')
     self.assertFalse(self.task.subs)
Пример #9
0
 def test_auto_percentage_subs_none_done(self):
     """Auto percentage return when there are subs but non are completed."""
     self.goal.subs = [classes.Sub('Sub1', 1), classes.Sub('Sub2', 2)]
     self.assertEqual(self.goal.auto_percentage(), 0)
Пример #10
0
 def test_edit_sub_no_new_title_arg(self, mock_get_input):
     """Editing Subitem without new title argument changes title."""
     self.task.subs = [classes.Sub('original sub description', 1)]
     mock_get_input.return_value = 'new sub title'
     self.task.edit_sub('1')
     self.assertEqual(self.task.subs[0].title, 'new sub title')
Пример #11
0
 def test_edit_sub_(self):
     """Editing Subitem with new title argument changes title correctly."""
     self.task.subs = [classes.Sub('original sub description', 1)]
     self.task.edit_sub('1 new sub title')
     self.assertEqual(self.task.subs[0].title, 'new sub title')
Пример #12
0
 def test_remove_sub_all_argless(self, mock_get_input):
     """Removing all subs results in an empty sub list."""
     self.task.subs = [classes.Sub('sub1', 1), classes.Sub('sub2', 2)]
     mock_get_input.return_value = 'all'
     self.task.remove_sub()
     self.assertEqual(self.task.subs, [])
Пример #13
0
 def test_remove_sub_argless(self, mock_get_input):
     """Removing a sub by index removes correct Sub from the sub list."""
     self.task.subs = [classes.Sub('sub1', 1), classes.Sub('sub2', 2)]
     mock_get_input.return_value = 2
     self.task.remove_sub()
     self.assertTrue(len(self.task.subs) == 1)
Пример #14
0
 def test_toggle_sub_done(self):
     """Toggling subs with 'done' arg changes all completed to True."""
     self.task.subs = [classes.Sub('sub', 1), classes.Sub('sub1', 2)]
     self.task.toggle_sub('done')
     self.assertEqual(self.task.subs[0].completed, True)
     self.assertEqual(self.task.subs[1].completed, True)
Пример #15
0
 def test_toggle_sub_true_false_argless(self, mock_get_input):
     """Toggling a sub changes its completed from True to False."""
     self.task.subs = [classes.Sub('sub', 1, completed=True)]
     mock_get_input.return_value = 1
     self.task.toggle_sub()
     self.assertEqual(self.task.subs[0].completed, False)
Пример #16
0
 def test_toggle_sub_true_false(self):
     """Toggling a sub changes its completed from True to False."""
     self.task.subs = [classes.Sub('sub', 1, completed=True)]
     self.task.toggle_sub(1)
     self.assertTrue(self.task.subs[0].completed is False)
Пример #17
0
 def test_toggle_sub_false_true(self):
     """Removing a sub of a Task via an argument modifies subs correctly."""
     self.task.subs = [classes.Sub('sub', 1)]
     self.task.toggle_sub(1)
     self.assertTrue(self.task.subs[0].completed is True)