# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# YouCompleteMe is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with YouCompleteMe.  If not, see <http://www.gnu.org/licenses/>.

from ycm.tests.test_utils import ( CurrentWorkingDirectory, ExtendedMock,
                                   MockVimBuffers, MockVimModule, VimBuffer,
                                   VimSign )
MockVimModule()

import contextlib
import os

from ycm.tests import ( PathToTestFile, test_utils, YouCompleteMeInstance,
                        WaitUntilReady )
from ycm.vimsupport import SIGN_BUFFER_ID_INITIAL_VALUE
from ycmd.responses import ( BuildDiagnosticData, Diagnostic, Location, Range,
                             UnknownExtraConf, ServerError )

from hamcrest import ( assert_that, contains_exactly, empty, equal_to,
                       has_entries, has_entry, has_item, has_items, has_key,
                       is_not )
from unittest.mock import call, MagicMock, patch
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with YouCompleteMe.  If not, see <http://www.gnu.org/licenses/>.

from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import *  # noqa

from nose.tools import eq_
from ycm.tests.test_utils import MockVimModule
vim_mock = MockVimModule()

from ycm.client import completion_request


class ConvertCompletionResponseToVimDatas_test(object):
    """ This class tests the
      completion_request._ConvertCompletionResponseToVimDatas method """
    def _Check(self, completion_id, completion_data, expected_vim_data):
        vim_data = completion_request._ConvertCompletionDataToVimData(
            completion_id, completion_data)

        try:
            eq_(expected_vim_data, vim_data)
        except Exception:
            print("Expected:\n'{0}'\nwhen parsing:\n'{1}'\nBut found:\n'{2}'".