Esempio n. 1
0
# 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 icm.tests.test_utils import MockVimModule

vim_mock = MockVimModule()

from icm.client import completion_request


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

        try:
            eq_(expected_vim_data, vim_data)
        except:
            print("Expected:\n'{0}'\nwhen parsing:\n'{1}'\nBut found:\n'{2}'".
Esempio n. 2
0
# 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 future.utils import PY2
from mock import patch, call
from nose.tools import eq_
from hamcrest import contains_string

from icm.tests.test_utils import ExpectedFailure, ExtendedMock, MockVimModule
MockVimModule()

from icm.tests import YouCompleteMeInstance

from ycmd.utils import ToBytes
from ycmd.request_wrap import RequestWrap


def ToBytesOnPY2(data):
    # To test the omnifunc, etc. returning strings, which can be of different
    # types depending on python version, we use ToBytes on PY2 and just the native
    # str on python3. This roughly matches what happens between py2 and py3
    # versions within Vim
    if PY2:
        return ToBytes(data)