def test_farmygame_update__updates_objects(mock_window): sut = FarmyGame() first_obj = MockGameObject() second_obj = MockGameObject() sut.game_objects.append(first_obj) sut.game_objects.append(second_obj) sut.update(0.34) first_obj.update.assert_called_once_with(0.34) second_obj.update.assert_called_once_with(0.34)
def test_farmygame_update__adds_new(mock_window): sut = FarmyGame() first_obj = MockGameObject() first_obj.add_new() second_obj = MockGameObject() sut.game_objects.append(first_obj) sut.game_objects.append(second_obj) assert len(sut.game_objects) == 3 sut.update(0.34) assert len(sut.game_objects) == 4
def test_farmygame_update__removes_dead(mock_window): sut = FarmyGame() first_obj = MockGameObject() second_obj = MockGameObject(dead=True) sut.game_objects.append(first_obj) sut.game_objects.append(second_obj) assert len(sut.game_objects) == 3 sut.update(0.34) assert len(sut.game_objects) == 2 assert second_obj not in sut.game_objects assert second_obj.delete.called