# encoding: utf-8
#
# Copyright (C) 2018 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd is free software: you can redistribute it and/or modify
# 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.
#
# ycmd 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 ycmd.  If not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division

from hamcrest.core.base_matcher import BaseMatcher
from hamcrest import ( assert_that,
                       contains,
                       contains_string,
                       equal_to,
                       has_entries,
                       has_entry,
                       matches_regexp )
from pprint import pprint
import requests
import os.path

from ycmd.tests.clangd import ( IsolatedYcmd,
                                SharedYcmd,
                                PathToTestFile,
                                RunAfterInitialized )
from ycmd.tests.test_utils import ( BuildRequest,
                                    ChunkMatcher,
                                    CombineRequest,
                                    LineColMatcher,
                                    LocationMatcher,
                                    ErrorMatcher,
                                    WithRetry,
                                    WaitUntilCompleterServerReady )
from ycmd.utils import ReadFile


# This test is isolated to trigger objcpp hooks, rather than fetching completer
# from cache.
@IsolatedYcmd()
def Subcommands_DefinedSubcommands_test( app ):
  file_path = PathToTestFile( 'GoTo_Clang_ZeroBasedLineAndColumn_test.cc' )
  RunAfterInitialized( app, {
      'request': {
        'completer_target': 'filetype_default',
        'line_num': 10,
        'column_num': 3,
        'filetype': 'objcpp',
        'filepath': file_path
      },
      'expect': {
        'response': requests.codes.ok,
        'data': contains( *sorted( [ 'ExecuteCommand',
                                     'FixIt',
                                     'Format',
                                     'GetDoc',
                                     'GetDocImprecise',
                                     'GetType',
                                     'GetTypeImprecise',
                                     'GoTo',
                                     'GoToDeclaration',
                                     'GoToDefinition',
                                     'GoToImprecise',
                                     'GoToInclude',
                                     'GoToReferences',
                                     'RefactorRename',
                                     'RestartServer' ] ) )
      },
      'route': '/defined_subcommands',
  } )


@SharedYcmd
def Subcommands_GoTo_ZeroBasedLineAndColumn_test( app ):
  file_path = PathToTestFile( 'GoTo_Clang_ZeroBasedLineAndColumn_test.cc' )
  RunAfterInitialized( app, {
      'request': {
          'contents': ReadFile( file_path ),
          'completer_target': 'filetype_default',
          'command_arguments': [ 'GoToDefinition' ],
          'line_num': 10,
          'column_num': 3,
          'filetype': 'cpp',
          'filepath': file_path
      },
      'expect': {
          'response': requests.codes.ok,
          'data': {
              'filepath': os.path.abspath( file_path ),
              'line_num': 2,
              'column_num': 8
          }
      },
      'route': '/run_completer_command',
  } )


@SharedYcmd
def RunGoToTest_all( app, folder, command, test ):
  filepath = PathToTestFile( folder, test[ 'req' ][ 0 ] )
  common_request = {
    'completer_target' : 'filetype_default',
    'filepath'         : filepath,
    'command_arguments': [ command ],
    'contents'         : ReadFile( filepath ),
    'filetype'         : 'cpp'
  }

  request = common_request
  request.update( {
    'line_num'  : test[ 'req' ][ 1 ],
    'column_num': test[ 'req' ][ 2 ],
  } )

  response = test[ 'res' ]

  if isinstance( response, list ):
    expect = {
      'response': requests.codes.ok,
      'data': contains( *[
        LocationMatcher(
          PathToTestFile( folder, os.path.normpath( location[ 0 ] ) ),
          location[ 1 ],
          location[ 2 ]
        ) for location in response
      ] )
    }
  elif isinstance( response, tuple ):
    expect = {
      'response': requests.codes.ok,
      'data': LocationMatcher(
        PathToTestFile( folder, os.path.normpath( response[ 0 ] ) ),
        response[ 1 ],
        response[ 2 ]
      )
    }
  else:
    expect = {
      'response': requests.codes.internal_server_error,
      'data': ErrorMatcher( RuntimeError, test[ 'res' ] )
    }

  RunAfterInitialized( app, {
    'request': request,
    'route'  : '/run_completer_command',
    'expect' : expect
  } )


def Subcommands_GoTo_all_test():
  tests = [
    # Local::x -> definition/declaration of x
    { 'req': ( 'goto.cc', 23, 21 ), 'res': ( 'goto.cc', 4, 9 ) },
    # Local::in_line -> definition/declaration of Local::in_line
    { 'req': ( 'goto.cc', 24, 26 ), 'res': ( 'goto.cc', 6, 10 ) },
    # Local -> definition/declaration of Local
    { 'req': ( 'goto.cc', 24, 16 ), 'res': ( 'goto.cc', 2, 11 ) },
    # Local::out_of_line -> definition of Local::out_of_line
    { 'req': ( 'goto.cc', 25, 27 ), 'res': ( 'goto.cc', 14, 13 ) },
    # GoToDeclaration alternates between definition and declaration
    { 'req': ( 'goto.cc', 14, 13 ), 'res': ( 'goto.cc', 11, 10 ) },
    { 'req': ( 'goto.cc', 11, 10 ), 'res': ( 'goto.cc', 14, 13 ) },
    # test -> definition and declaration of test
    { 'req': ( 'goto.cc', 21,  5 ), 'res': ( 'goto.cc', 19, 5 ) },
    { 'req': ( 'goto.cc', 19,  5 ), 'res': ( 'goto.cc', 21, 5 ) },
    # Unicøde
    { 'req': ( 'goto.cc', 34,  9 ), 'res': ( 'goto.cc', 32, 26 ) },
    # Another_Unicøde
    { 'req': ( 'goto.cc', 36, 17 ), 'res': ( 'goto.cc', 32, 54 ) },
    { 'req': ( 'goto.cc', 36, 25 ), 'res': ( 'goto.cc', 32, 54 ) },
    { 'req': ( 'goto.cc', 38,  3 ), 'res': ( 'goto.cc', 36, 28 ) },
    # Expected failures
    { 'req': ( 'goto.cc', 13,  1 ), 'res': 'Cannot jump to location' },
    { 'req': ( 'goto.cc', 16,  6 ), 'res': 'Cannot jump to location' },
  ]

  for test in tests:
    for cmd in [ 'GoToDefinition', 'GoTo', 'GoToImprecise' ]:
      yield RunGoToTest_all, '', cmd, test


def Subcommands_GoToDeclaration_all_test():
  tests = [
    # Local::x -> definition/declaration of x
    { 'req': ( 'goto.cc', 23, 21 ), 'res': ( 'goto.cc', 4, 9 ) },
    # Local::in_line -> definition/declaration of Local::in_line
    { 'req': ( 'goto.cc', 24, 26 ), 'res': ( 'goto.cc', 6, 10 ) },
    # Local -> definition/declaration of Local
    { 'req': ( 'goto.cc', 24, 16 ), 'res': ( 'goto.cc', 2, 11 ) },
    # Local::out_of_line -> declaration of Local::out_of_line
    { 'req': ( 'goto.cc', 25, 27 ), 'res': ( 'goto.cc', 11, 10 ) },
    # GoToDeclaration alternates between definition and declaration
    { 'req': ( 'goto.cc', 14, 13 ), 'res': ( 'goto.cc', 11, 10 ) },
    { 'req': ( 'goto.cc', 11, 10 ), 'res': ( 'goto.cc', 14, 13 ) },
    # test -> definition and declaration of test
    { 'req': ( 'goto.cc', 21,  5 ), 'res': ( 'goto.cc', 19, 5 ) },
    { 'req': ( 'goto.cc', 19,  5 ), 'res': ( 'goto.cc', 21, 5 ) },
    # Unicøde
    { 'req': ( 'goto.cc', 34,  9 ), 'res': ( 'goto.cc', 32, 26 ) },
    # Another_Unicøde
    { 'req': ( 'goto.cc', 36, 17 ), 'res': ( 'goto.cc', 32, 54 ) },
    { 'req': ( 'goto.cc', 36, 25 ), 'res': ( 'goto.cc', 32, 54 ) },
    { 'req': ( 'goto.cc', 38,  3 ), 'res': ( 'goto.cc', 36, 28 ) },
    # Expected failures
    { 'req': ( 'goto.cc', 13,  1 ), 'res': 'Cannot jump to location' },
    { 'req': ( 'goto.cc', 16,  6 ), 'res': 'Cannot jump to location' },
  ]

  for test in tests:
    yield RunGoToTest_all, '', 'GoToDeclaration', test


def Subcommands_GoToInclude_test():
  tests = [
    { 'req': ( 'main.cpp',  1,  6 ), 'res': ( 'a.hpp',        1, 1 ) },
    { 'req': ( 'main.cpp',  2, 14 ), 'res': ( 'system/a.hpp', 1, 1 ) },
    { 'req': ( 'main.cpp',  3,  1 ), 'res': ( 'quote/b.hpp',  1, 1 ) },
    # FIXME: should fail since b.hpp is included with angled brackets but its
    # folder is added with -iquote.
    { 'req': ( 'main.cpp',  4, 10 ), 'res': ( 'quote/b.hpp',  1, 1 ) },
    { 'req': ( 'main.cpp',  5, 11 ), 'res': ( 'system/c.hpp', 1, 1 ) },
    { 'req': ( 'main.cpp',  6, 11 ), 'res': ( 'system/c.hpp', 1, 1 ) },
    # Expected failures
    { 'req': ( 'main.cpp',  7,  1 ), 'res': 'Cannot jump to location' },
    { 'req': ( 'main.cpp', 10, 13 ), 'res': 'Cannot jump to location' },
  ]

  for test in tests:
    for cmd in [ 'GoToInclude', 'GoTo', 'GoToImprecise' ]:
      yield RunGoToTest_all, 'test-include', cmd, test


def Subcommands_GoToReferences_test():
  tests = [
    # Function
    { 'req': ( 'goto.cc', 14, 21 ), 'res': [ ( 'goto.cc', 11, 10 ),
                                             ( 'goto.cc', 14, 13 ),
                                             ( 'goto.cc', 25, 22 ) ] },
    # Namespace
    { 'req': ( 'goto.cc', 24, 17 ), 'res': [ ( 'goto.cc',  2, 11 ),
                                             ( 'goto.cc', 14,  6 ),
                                             ( 'goto.cc', 23, 14 ),
                                             ( 'goto.cc', 24, 15 ),
                                             ( 'goto.cc', 25, 15 ) ] },
    # Expected failure
    { 'req': ( 'goto.cc', 27,  8 ), 'res': 'Cannot jump to location' },
  ]

  for test in tests:
    yield RunGoToTest_all, '', 'GoToReferences', test


@SharedYcmd
def RunGetSemanticTest( app,
                        filepath,
                        filetype,
                        test,
                        command,
                        response = requests.codes.ok ):
  contents = ReadFile( filepath )
  common_args = {
    'completer_target' : 'filetype_default',
    'command_arguments': command,
    'line_num'         : 10,
    'column_num'       : 3,
    'filepath'         : filepath,
    'contents'         : contents,
    'filetype'         : filetype
  }

  args = test[ 0 ]
  if response == requests.codes.ok:
    if not isinstance( test[ 1 ], BaseMatcher ):
      expected = has_entry( 'message', contains_string( test[ 1 ] ) )
    else:
      expected = has_entry( 'message', test[ 1 ] )
  else:
    expected = test[ 1 ]

  request = common_args
  request.update( args )
  test = { 'request': request,
           'route': '/run_completer_command',
           'expect': { 'response': response,
                       'data': expected } }
  RunAfterInitialized( app, test )


def Subcommands_GetType_test():
  tests = [
    # Basic pod types
    [ { 'line_num': 24, 'column_num':  3 }, 'Foo' ],
    # [ { 'line_num': 12, 'column_num':  2 }, 'Foo' ],
    [ { 'line_num': 12, 'column_num':  8 }, 'Foo' ],
    [ { 'line_num': 12, 'column_num':  9 }, 'Foo' ],
    [ { 'line_num': 12, 'column_num': 10 }, 'Foo' ],
    # [ { 'line_num': 13, 'column_num':  3 }, 'int' ],
    [ { 'line_num': 13, 'column_num':  7 }, 'int' ],
    # [ { 'line_num': 15, 'column_num':  7 }, 'char' ],

    # Function
    # [ { 'line_num': 22, 'column_num':  2 }, 'int main()' ],
    [ { 'line_num': 22, 'column_num':  6 }, 'int main()' ],

    # Declared and canonical type
    # On Ns::
    [ { 'line_num': 25, 'column_num':  3 }, 'namespace Ns' ],
    # On Type (Type)
    # [ { 'line_num': 25, 'column_num':  8 },
    # 'Ns::Type => Ns::BasicType<char>' ],
    # On "a" (Ns::Type)
    # [ { 'line_num': 25, 'column_num': 15 },
    # 'Ns::Type => Ns::BasicType<char>' ],
    # [ { 'line_num': 26, 'column_num': 13 },
    # 'Ns::Type => Ns::BasicType<char>' ],

    # Cursor on decl for refs & pointers
    [ { 'line_num': 39, 'column_num':  3 }, 'Foo' ],
    [ { 'line_num': 39, 'column_num': 11 }, 'Foo &' ],
    [ { 'line_num': 39, 'column_num': 15 }, 'Foo' ],
    [ { 'line_num': 40, 'column_num':  3 }, 'Foo' ],
    [ { 'line_num': 40, 'column_num': 11 }, 'Foo *' ],
    [ { 'line_num': 40, 'column_num': 18 }, 'Foo' ],
    # [ { 'line_num': 42, 'column_num':  3 }, 'const Foo &' ],
    [ { 'line_num': 42, 'column_num': 16 }, 'const struct Foo &' ],
    # [ { 'line_num': 43, 'column_num':  3 }, 'const Foo *' ],
    [ { 'line_num': 43, 'column_num': 16 }, 'const struct Foo *' ],

    # Cursor on usage
    [ { 'line_num': 45, 'column_num': 13 }, 'const struct Foo' ],
    # [ { 'line_num': 45, 'column_num': 19 }, 'const int' ],
    [ { 'line_num': 46, 'column_num': 13 }, 'const struct Foo *' ],
    # [ { 'line_num': 46, 'column_num': 20 }, 'const int' ],
    [ { 'line_num': 47, 'column_num': 12 }, 'Foo' ],
    [ { 'line_num': 47, 'column_num': 17 }, 'int' ],
    [ { 'line_num': 48, 'column_num': 12 }, 'Foo *' ],
    [ { 'line_num': 48, 'column_num': 18 }, 'int' ],

    # Auto in declaration
    # [ { 'line_num': 28, 'column_num':  3 }, 'struct Foo &' ],
    # [ { 'line_num': 28, 'column_num': 11 }, 'struct Foo &' ],
    [ { 'line_num': 28, 'column_num': 18 }, 'struct Foo' ],
    # [ { 'line_num': 29, 'column_num':  3 }, 'Foo *' ],
    # [ { 'line_num': 29, 'column_num': 11 }, 'Foo *' ],
    [ { 'line_num': 29, 'column_num': 18 }, 'Foo' ],
    # [ { 'line_num': 31, 'column_num':  3 }, 'const Foo &' ],
    # [ { 'line_num': 31, 'column_num': 16 }, 'const Foo &' ],
    # [ { 'line_num': 32, 'column_num':  3 }, 'const Foo *' ],
    # [ { 'line_num': 32, 'column_num': 16 }, 'const Foo *' ],

    # Auto in usage
    # [ { 'line_num': 34, 'column_num': 14 }, 'const Foo' ],
    # [ { 'line_num': 34, 'column_num': 21 }, 'const int' ],
    # [ { 'line_num': 35, 'column_num': 14 }, 'const Foo *' ],
    # [ { 'line_num': 35, 'column_num': 22 }, 'const int' ],
    [ { 'line_num': 36, 'column_num': 13 }, 'Foo' ],
    [ { 'line_num': 36, 'column_num': 19 }, 'int' ],
    # [ { 'line_num': 37, 'column_num': 13 }, 'Foo *' ],
    [ { 'line_num': 37, 'column_num': 20 }, 'int' ],

    # Unicode
    [ { 'line_num': 51, 'column_num': 13 }, 'Unicøde *' ],

    # Bound methods
    # On Win32, methods pick up an __attribute__((thiscall)) to annotate their
    # calling convention.  This shows up in the type, which isn't ideal, but
    # also prohibitively complex to try and strip out.
    [ { 'line_num': 53, 'column_num': 15 },
      matches_regexp(
          r'int bar\(int i\)(?: __attribute__\(\(thiscall\)\))?' ) ],
    [ { 'line_num': 54, 'column_num': 18 },
      matches_regexp(
          r'int bar\(int i\)(?: __attribute__\(\(thiscall\)\))?' ) ],
  ]

  for subcommand in [ 'GetType', 'GetTypeImprecise' ]:
    for test in tests:
      yield ( RunGetSemanticTest,
              PathToTestFile( 'GetType_Clang_test.cc' ),
              'cpp',
              test,
              [ subcommand ] )


def Subcommands_GetDoc_test():
  tests = [
    # from local file
    [ { 'line_num': 5, 'column_num': 10 }, 'docstring', requests.codes.ok ],
    # from header
    [ { 'line_num': 6, 'column_num': 10 }, 'docstring', requests.codes.ok ],
    # no docstring
    [ { 'line_num': 7, 'column_num': 7 }, 'int x = 3', requests.codes.ok ],
    # no hover
    [ { 'line_num': 8, 'column_num': 1 },
      ErrorMatcher( RuntimeError, 'No hover information.' ),
      requests.codes.server_error ]
  ]
  for subcommand in [ 'GetDoc', 'GetDocImprecise' ]:
    for test in tests:
      yield ( RunGetSemanticTest,
              PathToTestFile( 'GetDoc_Clang_test.cc' ),
              'cpp',
              test,
              [ subcommand ],
              test[ 2 ] )


@SharedYcmd
def RunFixItTest( app, line, column, lang, file_path, check ):
  contents = ReadFile( file_path )

  language_options = {
    'cpp11': {
      'filetype'         : 'cpp',
    },
    'cuda': {
      'filetype'         : 'cuda',
    },
    'objective-c': {
      'filetype'         : 'objc',
    },
  }

  args = {
    'completer_target' : 'filetype_default',
    'contents'         : contents,
    'filepath'         : file_path,
    'command_arguments': [ 'FixIt' ],
    'line_num'         : line,
    'column_num'       : column,
  }
  args.update( language_options[ lang ] )
  test = { 'request': args, 'route': '/detailed_diagnostic' }
  # First get diags.
  diags = RunAfterInitialized( app, test )
  while 'message' in diags and 'diagnostics' in diags[ 'message' ].lower():
    receive_diags = { 'request': args, 'route': '/receive_messages' }
    RunAfterInitialized( app, receive_diags )
    diags = RunAfterInitialized( app, test )

  results = app.post_json( '/run_completer_command',
                           BuildRequest( **args ) ).json

  pprint( results )
  check( results )


def FixIt_Check_cpp11_Ins( results ):
  # First fixit
  #   switch(A()) { // expected-error{{explicit conversion to}}
  assert_that( results, has_entries( {
    'fixits': contains( has_entries( {
      'chunks': contains(
        has_entries( {
          'replacement_text': equal_to( 'static_cast<int>(' ),
          'range': has_entries( {
            'start': has_entries( { 'line_num': 16, 'column_num': 10 } ),
            'end'  : has_entries( { 'line_num': 16, 'column_num': 10 } ),
          } ),
        } ),
        has_entries( {
          'replacement_text': equal_to( ')' ),
          'range': has_entries( {
            'start': has_entries( { 'line_num': 16, 'column_num': 13 } ),
            'end'  : has_entries( { 'line_num': 16, 'column_num': 13 } ),
          } ),
        } )
      ),
      'location': has_entries( { 'line_num': 16, 'column_num': 0 } )
    } ) )
  } ) )


def FixIt_Check_cpp11_InsMultiLine( results ):
  # Similar to FixIt_Check_cpp11_1 but inserts split across lines
  #
  assert_that( results, has_entries( {
    'fixits': contains( has_entries( {
      'chunks': contains(
        has_entries( {
          'replacement_text': equal_to( 'static_cast<int>(' ),
          'range': has_entries( {
            'start': has_entries( { 'line_num': 26, 'column_num': 7 } ),
            'end'  : has_entries( { 'line_num': 26, 'column_num': 7 } ),
          } ),
        } ),
        has_entries( {
          'replacement_text': equal_to( ')' ),
          'range': has_entries( {
            'start': has_entries( { 'line_num': 28, 'column_num': 2 } ),
            'end'  : has_entries( { 'line_num': 28, 'column_num': 2 } ),
          } ),
        } )
      ),
      'location': has_entries( { 'line_num': 25, 'column_num': 14 } )
    } ) )
  } ) )


def FixIt_Check_cpp11_Del( results ):
  # Removal of ::
  assert_that( results, has_entries( {
    'fixits': contains( has_entries( {
      'chunks': contains(
        has_entries( {
          'replacement_text': equal_to( '' ),
          'range': has_entries( {
            'start': has_entries( { 'line_num': 35, 'column_num': 7 } ),
            'end'  : has_entries( { 'line_num': 35, 'column_num': 9 } ),
          } ),
        } )
      ),
      'location': has_entries( { 'line_num': 35, 'column_num': 7 } )
    } ) )
  } ) )


def FixIt_Check_cpp11_Repl( results ):
  assert_that( results, has_entries( {
    'fixits': contains( has_entries( {
      'chunks': contains(
        has_entries( {
          'replacement_text': equal_to( 'foo' ),
          'range': has_entries( {
            'start': has_entries( { 'line_num': 40, 'column_num': 6 } ),
            'end'  : has_entries( { 'line_num': 40, 'column_num': 9 } ),
          } ),
        } )
      ),
      'location': has_entries( { 'line_num': 40, 'column_num': 6 } )
    } ) )
  } ) )


def FixIt_Check_cpp11_DelAdd( results ):
  assert_that( results, has_entries( {
    'fixits': contains(
      has_entries( {
        'chunks': contains(
          has_entries( {
            'replacement_text': equal_to( '' ),
            'range': has_entries( {
              'start': has_entries( { 'line_num': 48, 'column_num': 3 } ),
              'end'  : has_entries( { 'line_num': 48, 'column_num': 4 } ),
            } ),
          } ),
          has_entries( {
            'replacement_text': equal_to( '~' ),
            'range': has_entries( {
              'start': has_entries( { 'line_num': 48, 'column_num': 9 } ),
              'end'  : has_entries( { 'line_num': 48, 'column_num': 9 } ),
            } ),
          } ),
        ),
        'location': has_entries( { 'line_num': 48, 'column_num': 3 } )
      } ),
      has_entries( {
        'chunks': contains(
          has_entries( {
            'replacement_text': equal_to( '= default;' ),
            'range': has_entries( {
              'start': has_entries( { 'line_num': 48, 'column_num': 15 } ),
              'end'  : has_entries( { 'line_num': 48, 'column_num': 17 } ),
            } ),
          } ),
        ),
        'location': has_entries( { 'line_num': 48, 'column_num': 3 } )
      } ),
    )
  } ) )


def FixIt_Check_objc( results ):
  assert_that( results, has_entries( {
    'fixits': contains( has_entries( {
      'chunks': contains(
        has_entries( {
          'replacement_text': equal_to( 'id' ),
          'range': has_entries( {
            'start': has_entries( { 'line_num': 5, 'column_num': 3 } ),
            'end'  : has_entries( { 'line_num': 5, 'column_num': 3 } ),
          } ),
        } )
      ),
      'location': has_entries( { 'line_num': 5, 'column_num': 3 } )
    } ) )
  } ) )


def FixIt_Check_objc_NoFixIt( results ):
  # and finally, a warning with no fixits
  assert_that( results, equal_to( { 'fixits': [] } ) )


def FixIt_Check_cpp11_MultiFirst( results ):
  assert_that( results, has_entries( {
    'fixits': contains(
      # first fix-it at 54,16
      has_entries( {
        'chunks': contains(
          has_entries( {
            'replacement_text': equal_to( 'foo' ),
            'range': has_entries( {
              'start': has_entries( { 'line_num': 54, 'column_num': 16 } ),
              'end'  : has_entries( { 'line_num': 54, 'column_num': 19 } ),
            } ),
          } )
        ),
        'location': has_entries( { 'line_num': 54, 'column_num': 15 } )
      } ),
      # second fix-it at 54,52
      has_entries( {
        'chunks': contains(
          has_entries( {
            'replacement_text': equal_to( '' ),
            'range': has_entries( {
              'start': has_entries( { 'line_num': 54, 'column_num': 52 } ),
              'end'  : has_entries( { 'line_num': 54, 'column_num': 53 } ),
            } ),
          } ),
          has_entries( {
            'replacement_text': equal_to( '~' ),
            'range': has_entries( {
              'start': has_entries( { 'line_num': 54, 'column_num': 58 } ),
              'end'  : has_entries( { 'line_num': 54, 'column_num': 58 } ),
            } ),
          } ),
        ),
        'location': has_entries( { 'line_num': 54, 'column_num': 15 } )
      } ),
      has_entries( {
        'chunks': contains(
          has_entries( {
            'replacement_text': equal_to( '= default;' ),
            'range': has_entries( {
              'start': has_entries( { 'line_num': 54, 'column_num': 64 } ),
              'end'  : has_entries( { 'line_num': 54, 'column_num': 67 } ),
            } ),
          } )
        ),
        'location': has_entries( { 'line_num': 54, 'column_num': 15 } )
      } ),
    )
  } ) )


def FixIt_Check_cpp11_MultiSecond( results ):
  assert_that( results, has_entries( {
    'fixits': contains(
      # first fix-it at 54,16
      has_entries( {
        'chunks': contains(
          has_entries( {
            'replacement_text': equal_to( 'foo' ),
            'range': has_entries( {
              'start': has_entries( { 'line_num': 54, 'column_num': 16 } ),
              'end'  : has_entries( { 'line_num': 54, 'column_num': 19 } ),
            } ),
          } )
        ),
        'location': has_entries( { 'line_num': 54, 'column_num': 51 } )
      } ),
      # second fix-it at 54,52
      has_entries( {
        'chunks': contains(
          has_entries( {
            'replacement_text': equal_to( '' ),
            'range': has_entries( {
              'start': has_entries( { 'line_num': 54, 'column_num': 52 } ),
              'end'  : has_entries( { 'line_num': 54, 'column_num': 53 } ),
            } ),
          } ),
          has_entries( {
            'replacement_text': equal_to( '~' ),
            'range': has_entries( {
              'start': has_entries( { 'line_num': 54, 'column_num': 58 } ),
              'end'  : has_entries( { 'line_num': 54, 'column_num': 58 } ),
            } ),
          } ),
        ),
        'location': has_entries( { 'line_num': 54, 'column_num': 51 } )
      } ),
      has_entries( {
        'chunks': contains(
          has_entries( {
            'replacement_text': equal_to( '= default;' ),
            'range': has_entries( {
              'start': has_entries( { 'line_num': 54, 'column_num': 64 } ),
              'end'  : has_entries( { 'line_num': 54, 'column_num': 67 } ),
            } ),
          } )
        ),
        'location': has_entries( { 'line_num': 54, 'column_num': 51 } )
      } ),
    )
  } ) )


def FixIt_Check_unicode_Ins( results ):
  assert_that( results, has_entries( {
    'fixits': contains( has_entries( {
      'chunks': contains(
        has_entries( {
          'replacement_text': equal_to( '=' ),
          'range': has_entries( {
            'start': has_entries( { 'line_num': 21, 'column_num': 9 } ),
            'end'  : has_entries( { 'line_num': 21, 'column_num': 11 } ),
          } ),
        } )
      ),
      'location': has_entries( { 'line_num': 21, 'column_num': 16 } )
    } ) )
  } ) )


def FixIt_Check_cpp11_Note( results ):
  assert_that( results, has_entries( {
    'fixits': contains(
      # First note: put parens around it
      has_entries( {
        'text': contains_string( 'parentheses around the assignment' ),
        'chunks': contains(
          ChunkMatcher( '(',
                        LineColMatcher( 59, 8 ),
                        LineColMatcher( 59, 8 ) ),
          ChunkMatcher( ')',
                        LineColMatcher( 61, 12 ),
                        LineColMatcher( 61, 12 ) )
        ),
        'location': LineColMatcher( 60, 1 ),
      } ),

      # Second note: change to ==
      has_entries( {
        'text': contains_string( '==' ),
        'chunks': contains(
          ChunkMatcher( '==',
                        LineColMatcher( 60, 8 ),
                        LineColMatcher( 60, 9 ) )
        ),
        'location': LineColMatcher( 60, 1 ),
      } ),
      # Unresolved, requires /resolve_fixit request
      has_entries( {
        'text': 'Extract subexpression to variable',
        'resolve': True,
        'command': has_entries( { 'command': 'clangd.applyTweak' } )
      } )
    )
  } ) )


def FixIt_Check_cpp11_SpellCheck( results ):
  assert_that( results, has_entries( {
    'fixits': contains(
      # Change to SpellingIsNotMyStrongPoint
      has_entries( {
        'text': contains_string( "change 'SpellingIsNotMyStringPiont' to "
                                 "'SpellingIsNotMyStrongPoint'" ),
        'chunks': contains(
          ChunkMatcher( 'SpellingIsNotMyStrongPoint',
                        LineColMatcher( 72, 9 ),
                        LineColMatcher( 72, 35 ) )
        ),
        'location': LineColMatcher( 72, 9 ),
      } ) )
  } ) )


def FixIt_Check_cuda( results ):
  assert_that( results, has_entries( {
    'fixits': contains(
      has_entries( {
        'text': contains_string(
           "change 'int' to 'void'" ),
        'chunks': contains(
          ChunkMatcher( 'void',
                        LineColMatcher( 3, 12 ),
                        LineColMatcher( 3, 15 ) )
        ),
        'location': LineColMatcher( 3, 12 ),
      } ) )
  } ) )


def FixIt_Check_SubexprExtract_Resolved( results ):
  assert_that( results, has_entries( {
    'fixits': contains( has_entries( {
        'text': 'Extract subexpression to variable',
        'chunks': contains(
          ChunkMatcher( 'auto dummy = foo(i + 3);\n  ',
                        LineColMatcher( 84, 3 ),
                        LineColMatcher( 84, 3 ) ),
          ChunkMatcher( 'dummy',
                        LineColMatcher( 84, 10 ),
                        LineColMatcher( 84, 22 ) ),
        )
    } ) )
  } ) )


def FixIt_Check_RawStringReplace_Resolved( results ):
  assert_that( results, has_entries( {
    'fixits': contains( has_entries( {
        'text': 'Convert to raw string',
        'chunks': contains(
          ChunkMatcher( 'R"(\\\\r\\asd\n\\v)"',
                        LineColMatcher( 80, 19 ),
                        LineColMatcher( 80, 36 ) ),
        )
    } ) )
  } ) )


def FixIt_Check_MacroExpand_Resolved( results ):
  assert_that( results, has_entries( {
    'fixits': contains( has_entries( {
        'text': "Expand macro 'DECLARE_INT'",
        'chunks': contains(
          ChunkMatcher( 'int i',
                        LineColMatcher( 83,  3 ),
                        LineColMatcher( 83, 17 ) ),
        )
    } ) )
  } ) )


def FixIt_Check_AutoExpand_Resolved( results ):
  assert_that( results, has_entries( {
    'fixits': contains( has_entries( {
        'text': "Expand auto type",
        'chunks': contains(
          ChunkMatcher( 'const char *',
                        LineColMatcher( 80, 1 ),
                        LineColMatcher( 80, 6 ) ),
        )
    } ) )
  } ) )


def Subcommands_FixIt_all_test():
  cfile = PathToTestFile( 'FixIt_Clang_cpp11.cpp' )
  mfile = PathToTestFile( 'objc', 'FixIt_Clang_objc.m' )
  cufile = PathToTestFile( 'cuda', 'fixit_test.cu' )
  ufile = PathToTestFile( 'unicode.cc' )

  tests = [
    # L
    # i   C
    # n   o
    # e   l   Lang     File,  Checker
    [ 16, 0,  'cpp11', cfile, FixIt_Check_cpp11_Ins ],
    [ 25, 14, 'cpp11', cfile, FixIt_Check_cpp11_InsMultiLine ],
    [ 35, 7,  'cpp11', cfile, FixIt_Check_cpp11_Del ],
    [ 40, 6,  'cpp11', cfile, FixIt_Check_cpp11_Repl ],
    [ 48, 3,  'cpp11', cfile, FixIt_Check_cpp11_DelAdd ],

    [ 5, 3,   'objective-c', mfile, FixIt_Check_objc ],
    [ 7, 1,   'objective-c', mfile, FixIt_Check_objc_NoFixIt ],

    [ 3, 12,  'cuda', cufile, FixIt_Check_cuda ],

    # multiple errors on a single line; both with fixits
    [ 54, 15, 'cpp11', cfile, FixIt_Check_cpp11_MultiFirst ],

    # should put closest fix-it first?
    [ 54, 51, 'cpp11', cfile, FixIt_Check_cpp11_MultiSecond ],

    # unicode in line for fixit
    [ 21, 16, 'cpp11', ufile, FixIt_Check_unicode_Ins ],

    # FixIt attached to a "child" diagnostic (i.e. a Note)
    [ 60, 1,  'cpp11', cfile, FixIt_Check_cpp11_Note ],

    # FixIt due to forced spell checking
    [ 72, 9,  'cpp11', cfile, FixIt_Check_cpp11_SpellCheck ],
  ]

  for test in tests:
    yield RunFixItTest, test[ 0 ], test[ 1 ], test[ 2 ], test[ 3 ], test[ 4 ]


@WithRetry
@SharedYcmd
def RunRangedFixItTest( app, rng, expected ):
  contents = ReadFile( PathToTestFile( 'FixIt_Clang_cpp11.cpp' ) )
  args = {
    'completer_target' : 'filetype_default',
    'contents'         : contents,
    'filepath'         : PathToTestFile( 'FixIt_Clang_cpp11.cpp' ),
    'command_arguments': [ 'FixIt' ],
    'range'            : rng,
    'filetype'         : 'cpp'
  }
  app.post_json( '/event_notification',
                 CombineRequest( args, {
                   'event_name': 'FileReadyToParse',
                 } ),
                 expect_errors = True )
  WaitUntilCompleterServerReady( app, 'cpp' )
  response = app.post_json( '/run_completer_command',
                            BuildRequest( **args ) ).json
  args[ 'fixit' ] = response[ 'fixits' ][ 0 ]
  response = app.post_json( '/resolve_fixit',
                            BuildRequest( **args ) ).json
  print( 'Resolved fixit response = ' )
  print( response )
  expected( response )


def Subcommands_FixIt_Ranged_test():
  expand_auto_range = {
    'start': { 'line_num': 80, 'column_num': 1 },
    'end': { 'line_num': 80, 'column_num': 4 },
  }
  subexpression_extract_range = {
    'start': { 'line_num': 84, 'column_num': 14 },
    'end': { 'line_num': 84, 'column_num': 20 },
  }
  macro_expand_range = {
    'start': { 'line_num': 83, 'column_num': 3 },
    'end': { 'line_num': 83, 'column_num': 13 },
  }
  raw_string_range = {
    'start': { 'line_num': 80, 'column_num': 19 },
    'end': { 'line_num': 80, 'column_num': 35 },
  }
  tests = [
    [ expand_auto_range, FixIt_Check_AutoExpand_Resolved ],
    [ macro_expand_range, FixIt_Check_MacroExpand_Resolved ],
    [ subexpression_extract_range, FixIt_Check_SubexprExtract_Resolved ],
    [ raw_string_range, FixIt_Check_RawStringReplace_Resolved ],
  ]
  for test in tests:
    yield RunRangedFixItTest, test[ 0 ], test[ 1 ]


@WithRetry
@SharedYcmd
def Subcommands_FixIt_AlreadyResolved_test( app ):
  filename = PathToTestFile( 'FixIt_Clang_cpp11.cpp' )
  request = {
    'completer_target' : 'filetype_default',
    'contents'         : ReadFile( filename ),
    'filepath'         : filename,
    'command_arguments': [ 'FixIt' ],
    'line_num'         : 16,
    'column_num'       : 1,
    'filetype'         : 'cpp'
  }
  app.post_json( '/event_notification',
                 CombineRequest( request, {
                   'event_name': 'FileReadyToParse',
                 } ),
                 expect_errors = True )
  WaitUntilCompleterServerReady( app, 'cpp' )
  expected = app.post_json( '/run_completer_command',
                            BuildRequest( **request ) ).json
  print( 'expected = ' )
  print( expected )
  request[ 'fixit' ] = expected[ 'fixits' ][ 0 ]
  actual = app.post_json( '/resolve_fixit',
                          BuildRequest( **request ) ).json
  print( 'actual = ' )
  print( actual )
  assert_that( actual, equal_to( expected ) )


@SharedYcmd
def Subcommands_RefactorRename_test( app ):
  test = {
    'request': {
      'filetype': 'cpp',
      'completer_target': 'filetype_default',
      'contents': ReadFile( PathToTestFile( 'basic.cpp' ) ),
      'filepath': PathToTestFile( 'basic.cpp' ),
      'command_arguments': [ 'RefactorRename', 'Bar' ],
      'line_num': 17,
      'column_num': 4,
    },
    'expect': {
      'response': requests.codes.ok,
      'data': has_entries( {
        'fixits': contains( has_entries( {
          'chunks': contains(
            ChunkMatcher( 'Bar',
                          LineColMatcher( 1, 8 ),
                          LineColMatcher( 1, 11 ) ),
            ChunkMatcher( 'Bar',
                          LineColMatcher( 9, 3 ),
                          LineColMatcher( 9, 6 ) ),
            ChunkMatcher( '\n\n',
                          LineColMatcher( 12, 2 ),
                          LineColMatcher( 15, 1 ) ),
            ChunkMatcher( 'Bar',
                          LineColMatcher( 15,  8 ),
                          LineColMatcher( 15, 11 ) ),
            ChunkMatcher( ' ',
                          LineColMatcher( 15,  46 ),
                          LineColMatcher( 16,  1 ) ),
            ChunkMatcher( 'Bar',
                          LineColMatcher( 17, 3 ),
                          LineColMatcher( 17, 6 ) ),
            ChunkMatcher( '',
                          LineColMatcher( 17, 14 ),
                          LineColMatcher( 17, 15 ) ),
            ChunkMatcher( ' ',
                          LineColMatcher( 17, 17 ),
                          LineColMatcher( 17, 17 ) ),
            ChunkMatcher( ' ',
                          LineColMatcher( 17, 19 ),
                          LineColMatcher( 17, 19 ) ),
          )
        } ) )
      } )
    },
    'route': '/run_completer_command'
  }
  RunAfterInitialized( app, test )

[((1957, 1971), 'ycmd.tests.clangd.IsolatedYcmd', 'IsolatedYcmd', ([], {}), '()\n', (1969, 1971), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((2034, 2093), 'ycmd.tests.clangd.PathToTestFile', 'PathToTestFile', (['"""GoTo_Clang_ZeroBasedLineAndColumn_test.cc"""'], {}), "('GoTo_Clang_ZeroBasedLineAndColumn_test.cc')\n", (2048, 2093), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((3294, 3353), 'ycmd.tests.clangd.PathToTestFile', 'PathToTestFile', (['"""GoTo_Clang_ZeroBasedLineAndColumn_test.cc"""'], {}), "('GoTo_Clang_ZeroBasedLineAndColumn_test.cc')\n", (3308, 3353), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((4016, 4054), 'ycmd.tests.clangd.PathToTestFile', 'PathToTestFile', (['folder', "test['req'][0]"], {}), "(folder, test['req'][0])\n", (4030, 4054), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((5146, 5249), 'ycmd.tests.clangd.RunAfterInitialized', 'RunAfterInitialized', (['app', "{'request': request, 'route': '/run_completer_command', 'expect': expect}"], {}), "(app, {'request': request, 'route':\n    '/run_completer_command', 'expect': expect})\n", (5165, 5249), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((10245, 10263), 'ycmd.utils.ReadFile', 'ReadFile', (['filepath'], {}), '(filepath)\n', (10253, 10263), False, 'from ycmd.utils import ReadFile\n'), ((11015, 11045), 'ycmd.tests.clangd.RunAfterInitialized', 'RunAfterInitialized', (['app', 'test'], {}), '(app, test)\n', (11034, 11045), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((16013, 16032), 'ycmd.utils.ReadFile', 'ReadFile', (['file_path'], {}), '(file_path)\n', (16021, 16032), False, 'from ycmd.utils import ReadFile\n'), ((16607, 16637), 'ycmd.tests.clangd.RunAfterInitialized', 'RunAfterInitialized', (['app', 'test'], {}), '(app, test)\n', (16626, 16637), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((16991, 17006), 'pprint.pprint', 'pprint', (['results'], {}), '(results)\n', (16997, 17006), False, 'from pprint import pprint\n'), ((29770, 29809), 'ycmd.tests.clangd.PathToTestFile', 'PathToTestFile', (['"""FixIt_Clang_cpp11.cpp"""'], {}), "('FixIt_Clang_cpp11.cpp')\n", (29784, 29809), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((29822, 29866), 'ycmd.tests.clangd.PathToTestFile', 'PathToTestFile', (['"""objc"""', '"""FixIt_Clang_objc.m"""'], {}), "('objc', 'FixIt_Clang_objc.m')\n", (29836, 29866), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((29880, 29919), 'ycmd.tests.clangd.PathToTestFile', 'PathToTestFile', (['"""cuda"""', '"""fixit_test.cu"""'], {}), "('cuda', 'fixit_test.cu')\n", (29894, 29919), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((29932, 29960), 'ycmd.tests.clangd.PathToTestFile', 'PathToTestFile', (['"""unicode.cc"""'], {}), "('unicode.cc')\n", (29946, 29960), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((31741, 31782), 'ycmd.tests.test_utils.WaitUntilCompleterServerReady', 'WaitUntilCompleterServerReady', (['app', '"""cpp"""'], {}), "(app, 'cpp')\n", (31770, 31782), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((33126, 33165), 'ycmd.tests.clangd.PathToTestFile', 'PathToTestFile', (['"""FixIt_Clang_cpp11.cpp"""'], {}), "('FixIt_Clang_cpp11.cpp')\n", (33140, 33165), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((33640, 33681), 'ycmd.tests.test_utils.WaitUntilCompleterServerReady', 'WaitUntilCompleterServerReady', (['app', '"""cpp"""'], {}), "(app, 'cpp')\n", (33669, 33681), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((35933, 35963), 'ycmd.tests.clangd.RunAfterInitialized', 'RunAfterInitialized', (['app', 'test'], {}), '(app, test)\n', (35952, 35963), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((4225, 4243), 'ycmd.utils.ReadFile', 'ReadFile', (['filepath'], {}), '(filepath)\n', (4233, 4243), False, 'from ycmd.utils import ReadFile\n'), ((16790, 16829), 'ycmd.tests.clangd.RunAfterInitialized', 'RunAfterInitialized', (['app', 'receive_diags'], {}), '(app, receive_diags)\n', (16809, 16829), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((16844, 16874), 'ycmd.tests.clangd.RunAfterInitialized', 'RunAfterInitialized', (['app', 'test'], {}), '(app, test)\n', (16863, 16874), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((21777, 21801), 'hamcrest.equal_to', 'equal_to', (["{'fixits': []}"], {}), "({'fixits': []})\n", (21785, 21801), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((31237, 31276), 'ycmd.tests.clangd.PathToTestFile', 'PathToTestFile', (['"""FixIt_Clang_cpp11.cpp"""'], {}), "('FixIt_Clang_cpp11.cpp')\n", (31251, 31276), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((31397, 31436), 'ycmd.tests.clangd.PathToTestFile', 'PathToTestFile', (['"""FixIt_Clang_cpp11.cpp"""'], {}), "('FixIt_Clang_cpp11.cpp')\n", (31411, 31436), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((31600, 31656), 'ycmd.tests.test_utils.CombineRequest', 'CombineRequest', (['args', "{'event_name': 'FileReadyToParse'}"], {}), "(args, {'event_name': 'FileReadyToParse'})\n", (31614, 31656), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((33252, 33270), 'ycmd.utils.ReadFile', 'ReadFile', (['filename'], {}), '(filename)\n', (33260, 33270), False, 'from ycmd.utils import ReadFile\n'), ((33496, 33555), 'ycmd.tests.test_utils.CombineRequest', 'CombineRequest', (['request', "{'event_name': 'FileReadyToParse'}"], {}), "(request, {'event_name': 'FileReadyToParse'})\n", (33510, 33555), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((34060, 34078), 'hamcrest.equal_to', 'equal_to', (['expected'], {}), '(expected)\n', (34068, 34078), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((10730, 10759), 'hamcrest.has_entry', 'has_entry', (['"""message"""', 'test[1]'], {}), "('message', test[1])\n", (10739, 10759), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((14700, 14775), 'hamcrest.matches_regexp', 'matches_regexp', (['"""int bar\\\\(int i\\\\)(?: __attribute__\\\\(\\\\(thiscall\\\\)\\\\))?"""'], {}), "('int bar\\\\(int i\\\\)(?: __attribute__\\\\(\\\\(thiscall\\\\)\\\\))?')\n", (14714, 14775), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((14836, 14911), 'hamcrest.matches_regexp', 'matches_regexp', (['"""int bar\\\\(int i\\\\)(?: __attribute__\\\\(\\\\(thiscall\\\\)\\\\))?"""'], {}), "('int bar\\\\(int i\\\\)(?: __attribute__\\\\(\\\\(thiscall\\\\)\\\\))?')\n", (14850, 14911), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((15565, 15616), 'ycmd.tests.test_utils.ErrorMatcher', 'ErrorMatcher', (['RuntimeError', '"""No hover information."""'], {}), "(RuntimeError, 'No hover information.')\n", (15577, 15616), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((16958, 16978), 'ycmd.tests.test_utils.BuildRequest', 'BuildRequest', ([], {}), '(**args)\n', (16970, 16978), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((31867, 31887), 'ycmd.tests.test_utils.BuildRequest', 'BuildRequest', ([], {}), '(**args)\n', (31879, 31887), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((32017, 32037), 'ycmd.tests.test_utils.BuildRequest', 'BuildRequest', ([], {}), '(**args)\n', (32029, 32037), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((33766, 33789), 'ycmd.tests.test_utils.BuildRequest', 'BuildRequest', ([], {}), '(**request)\n', (33778, 33789), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((33963, 33986), 'ycmd.tests.test_utils.BuildRequest', 'BuildRequest', ([], {}), '(**request)\n', (33975, 33986), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((34319, 34346), 'ycmd.tests.clangd.PathToTestFile', 'PathToTestFile', (['"""basic.cpp"""'], {}), "('basic.cpp')\n", (34333, 34346), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((3427, 3446), 'ycmd.utils.ReadFile', 'ReadFile', (['file_path'], {}), '(file_path)\n', (3435, 3446), False, 'from ycmd.utils import ReadFile\n'), ((5093, 5132), 'ycmd.tests.test_utils.ErrorMatcher', 'ErrorMatcher', (['RuntimeError', "test['res']"], {}), "(RuntimeError, test['res'])\n", (5105, 5132), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((10672, 10696), 'hamcrest.contains_string', 'contains_string', (['test[1]'], {}), '(test[1])\n', (10687, 10696), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((34268, 34295), 'ycmd.tests.clangd.PathToTestFile', 'PathToTestFile', (['"""basic.cpp"""'], {}), "('basic.cpp')\n", (34282, 34295), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((15053, 15092), 'ycmd.tests.clangd.PathToTestFile', 'PathToTestFile', (['"""GetType_Clang_test.cc"""'], {}), "('GetType_Clang_test.cc')\n", (15067, 15092), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((15784, 15822), 'ycmd.tests.clangd.PathToTestFile', 'PathToTestFile', (['"""GetDoc_Clang_test.cc"""'], {}), "('GetDoc_Clang_test.cc')\n", (15798, 15822), False, 'from ycmd.tests.clangd import IsolatedYcmd, SharedYcmd, PathToTestFile, RunAfterInitialized\n'), ((17854, 17900), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 16, 'column_num': 0}"], {}), "({'line_num': 16, 'column_num': 0})\n", (17865, 17900), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((18744, 18791), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 25, 'column_num': 14}"], {}), "({'line_num': 25, 'column_num': 14})\n", (18755, 18791), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((19279, 19325), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 35, 'column_num': 7}"], {}), "({'line_num': 35, 'column_num': 7})\n", (19290, 19325), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((19799, 19845), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 40, 'column_num': 6}"], {}), "({'line_num': 40, 'column_num': 6})\n", (19810, 19845), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((20637, 20683), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 48, 'column_num': 3}"], {}), "({'line_num': 48, 'column_num': 3})\n", (20648, 20683), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((21082, 21128), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 48, 'column_num': 3}"], {}), "({'line_num': 48, 'column_num': 3})\n", (21093, 21128), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((21600, 21645), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 5, 'column_num': 3}"], {}), "({'line_num': 5, 'column_num': 3})\n", (21611, 21645), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((22323, 22370), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 15}"], {}), "({'line_num': 54, 'column_num': 15})\n", (22334, 22370), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((23084, 23131), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 15}"], {}), "({'line_num': 54, 'column_num': 15})\n", (23095, 23131), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((23529, 23576), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 15}"], {}), "({'line_num': 54, 'column_num': 15})\n", (23540, 23576), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((24122, 24169), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 51}"], {}), "({'line_num': 54, 'column_num': 51})\n", (24133, 24169), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((24883, 24930), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 51}"], {}), "({'line_num': 54, 'column_num': 51})\n", (24894, 24930), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((25328, 25375), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 51}"], {}), "({'line_num': 54, 'column_num': 51})\n", (25339, 25375), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((25856, 25903), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 21, 'column_num': 16}"], {}), "({'line_num': 21, 'column_num': 16})\n", (25867, 25903), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((26108, 26160), 'hamcrest.contains_string', 'contains_string', (['"""parentheses around the assignment"""'], {}), "('parentheses around the assignment')\n", (26123, 26160), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((26482, 26503), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(60)', '(1)'], {}), '(60, 1)\n', (26496, 26503), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((26590, 26611), 'hamcrest.contains_string', 'contains_string', (['"""=="""'], {}), "('==')\n", (26605, 26611), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((26803, 26824), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(60)', '(1)'], {}), '(60, 1)\n', (26817, 26824), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((27009, 27054), 'hamcrest.has_entries', 'has_entries', (["{'command': 'clangd.applyTweak'}"], {}), "({'command': 'clangd.applyTweak'})\n", (27020, 27054), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((27275, 27366), 'hamcrest.contains_string', 'contains_string', (['"""change \'SpellingIsNotMyStringPiont\' to \'SpellingIsNotMyStrongPoint\'"""'], {}), '(\n    "change \'SpellingIsNotMyStringPiont\' to \'SpellingIsNotMyStrongPoint\'")\n', (27290, 27366), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((27614, 27635), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(72)', '(9)'], {}), '(72, 9)\n', (27628, 27635), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((27794, 27835), 'hamcrest.contains_string', 'contains_string', (['"""change \'int\' to \'void\'"""'], {}), '("change \'int\' to \'void\'")\n', (27809, 27835), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((28040, 28061), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(3)', '(12)'], {}), '(3, 12)\n', (28054, 28061), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((26245, 26266), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(59)', '(8)'], {}), '(59, 8)\n', (26259, 26266), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((26294, 26315), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(59)', '(8)'], {}), '(59, 8)\n', (26308, 26315), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((26374, 26396), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(61)', '(12)'], {}), '(61, 12)\n', (26388, 26396), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((26424, 26446), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(61)', '(12)'], {}), '(61, 12)\n', (26438, 26446), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((26697, 26718), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(60)', '(8)'], {}), '(60, 8)\n', (26711, 26718), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((26746, 26767), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(60)', '(9)'], {}), '(60, 9)\n', (26760, 26767), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((27507, 27528), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(72)', '(9)'], {}), '(72, 9)\n', (27521, 27528), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((27556, 27578), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(72)', '(35)'], {}), '(72, 35)\n', (27570, 27578), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((27934, 27955), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(3)', '(12)'], {}), '(3, 12)\n', (27948, 27955), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((27983, 28004), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(3)', '(15)'], {}), '(3, 15)\n', (27997, 28004), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((28378, 28399), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(84)', '(3)'], {}), '(84, 3)\n', (28392, 28399), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((28427, 28448), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(84)', '(3)'], {}), '(84, 3)\n', (28441, 28448), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((28511, 28533), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(84)', '(10)'], {}), '(84, 10)\n', (28525, 28533), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((28561, 28583), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(84)', '(22)'], {}), '(84, 22)\n', (28575, 28583), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((28892, 28914), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(80)', '(19)'], {}), '(80, 19)\n', (28906, 28914), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((28942, 28964), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(80)', '(36)'], {}), '(80, 36)\n', (28956, 28964), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((29258, 29279), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(83)', '(3)'], {}), '(83, 3)\n', (29272, 29279), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((29308, 29330), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(83)', '(17)'], {}), '(83, 17)\n', (29322, 29330), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((29620, 29641), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(80)', '(1)'], {}), '(80, 1)\n', (29634, 29641), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((29669, 29690), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(80)', '(6)'], {}), '(80, 6)\n', (29683, 29690), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((17305, 17334), 'hamcrest.equal_to', 'equal_to', (['"""static_cast<int>("""'], {}), "('static_cast<int>(')\n", (17313, 17334), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((17601, 17614), 'hamcrest.equal_to', 'equal_to', (['""")"""'], {}), "(')')\n", (17609, 17614), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((18199, 18228), 'hamcrest.equal_to', 'equal_to', (['"""static_cast<int>("""'], {}), "('static_cast<int>(')\n", (18207, 18228), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((18493, 18506), 'hamcrest.equal_to', 'equal_to', (['""")"""'], {}), "(')')\n", (18501, 18506), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((19029, 19041), 'hamcrest.equal_to', 'equal_to', (['""""""'], {}), "('')\n", (19037, 19041), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((19546, 19561), 'hamcrest.equal_to', 'equal_to', (['"""foo"""'], {}), "('foo')\n", (19554, 19561), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((20080, 20092), 'hamcrest.equal_to', 'equal_to', (['""""""'], {}), "('')\n", (20088, 20092), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((20371, 20384), 'hamcrest.equal_to', 'equal_to', (['"""~"""'], {}), "('~')\n", (20379, 20384), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((20805, 20827), 'hamcrest.equal_to', 'equal_to', (['"""= default;"""'], {}), "('= default;')\n", (20813, 20827), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((21350, 21364), 'hamcrest.equal_to', 'equal_to', (['"""id"""'], {}), "('id')\n", (21358, 21364), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((22054, 22069), 'hamcrest.equal_to', 'equal_to', (['"""foo"""'], {}), "('foo')\n", (22062, 22069), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((22523, 22535), 'hamcrest.equal_to', 'equal_to', (['""""""'], {}), "('')\n", (22531, 22535), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((22816, 22829), 'hamcrest.equal_to', 'equal_to', (['"""~"""'], {}), "('~')\n", (22824, 22829), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((23253, 23275), 'hamcrest.equal_to', 'equal_to', (['"""= default;"""'], {}), "('= default;')\n", (23261, 23275), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((23853, 23868), 'hamcrest.equal_to', 'equal_to', (['"""foo"""'], {}), "('foo')\n", (23861, 23868), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((24322, 24334), 'hamcrest.equal_to', 'equal_to', (['""""""'], {}), "('')\n", (24330, 24334), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((24615, 24628), 'hamcrest.equal_to', 'equal_to', (['"""~"""'], {}), "('~')\n", (24623, 24628), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((25052, 25074), 'hamcrest.equal_to', 'equal_to', (['"""= default;"""'], {}), "('= default;')\n", (25060, 25074), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((25604, 25617), 'hamcrest.equal_to', 'equal_to', (['"""="""'], {}), "('=')\n", (25612, 25617), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((34672, 34692), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(1)', '(8)'], {}), '(1, 8)\n', (34686, 34692), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((34722, 34743), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(1)', '(11)'], {}), '(1, 11)\n', (34736, 34743), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((34808, 34828), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(9)', '(3)'], {}), '(9, 3)\n', (34822, 34828), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((34858, 34878), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(9)', '(6)'], {}), '(9, 6)\n', (34872, 34878), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((34944, 34965), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(12)', '(2)'], {}), '(12, 2)\n', (34958, 34965), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((34995, 35016), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(15)', '(1)'], {}), '(15, 1)\n', (35009, 35016), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((35081, 35102), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(15)', '(8)'], {}), '(15, 8)\n', (35095, 35102), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((35133, 35155), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(15)', '(11)'], {}), '(15, 11)\n', (35147, 35155), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((35218, 35240), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(15)', '(46)'], {}), '(15, 46)\n', (35232, 35240), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((35271, 35292), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(16)', '(1)'], {}), '(16, 1)\n', (35285, 35292), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((35358, 35379), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(17)', '(3)'], {}), '(17, 3)\n', (35372, 35379), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((35409, 35430), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(17)', '(6)'], {}), '(17, 6)\n', (35423, 35430), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((35492, 35514), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(17)', '(14)'], {}), '(17, 14)\n', (35506, 35514), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((35544, 35566), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(17)', '(15)'], {}), '(17, 15)\n', (35558, 35566), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((35629, 35651), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(17)', '(17)'], {}), '(17, 17)\n', (35643, 35651), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((35681, 35703), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(17)', '(17)'], {}), '(17, 17)\n', (35695, 35703), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((35766, 35788), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(17)', '(19)'], {}), '(17, 19)\n', (35780, 35788), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((35818, 35840), 'ycmd.tests.test_utils.LineColMatcher', 'LineColMatcher', (['(17)', '(19)'], {}), '(17, 19)\n', (35832, 35840), False, 'from ycmd.tests.test_utils import BuildRequest, ChunkMatcher, CombineRequest, LineColMatcher, LocationMatcher, ErrorMatcher, WithRetry, WaitUntilCompleterServerReady\n'), ((17393, 17440), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 16, 'column_num': 10}"], {}), "({'line_num': 16, 'column_num': 10})\n", (17404, 17440), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((17467, 17514), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 16, 'column_num': 10}"], {}), "({'line_num': 16, 'column_num': 10})\n", (17478, 17514), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((17673, 17720), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 16, 'column_num': 13}"], {}), "({'line_num': 16, 'column_num': 13})\n", (17684, 17720), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((17747, 17794), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 16, 'column_num': 13}"], {}), "({'line_num': 16, 'column_num': 13})\n", (17758, 17794), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((18287, 18333), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 26, 'column_num': 7}"], {}), "({'line_num': 26, 'column_num': 7})\n", (18298, 18333), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((18360, 18406), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 26, 'column_num': 7}"], {}), "({'line_num': 26, 'column_num': 7})\n", (18371, 18406), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((18565, 18611), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 28, 'column_num': 2}"], {}), "({'line_num': 28, 'column_num': 2})\n", (18576, 18611), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((18638, 18684), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 28, 'column_num': 2}"], {}), "({'line_num': 28, 'column_num': 2})\n", (18649, 18684), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((19100, 19146), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 35, 'column_num': 7}"], {}), "({'line_num': 35, 'column_num': 7})\n", (19111, 19146), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((19173, 19219), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 35, 'column_num': 9}"], {}), "({'line_num': 35, 'column_num': 9})\n", (19184, 19219), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((19620, 19666), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 40, 'column_num': 6}"], {}), "({'line_num': 40, 'column_num': 6})\n", (19631, 19666), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((19693, 19739), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 40, 'column_num': 9}"], {}), "({'line_num': 40, 'column_num': 9})\n", (19704, 19739), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((20155, 20201), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 48, 'column_num': 3}"], {}), "({'line_num': 48, 'column_num': 3})\n", (20166, 20201), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((20230, 20276), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 48, 'column_num': 4}"], {}), "({'line_num': 48, 'column_num': 4})\n", (20241, 20276), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((20447, 20493), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 48, 'column_num': 9}"], {}), "({'line_num': 48, 'column_num': 9})\n", (20458, 20493), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((20522, 20568), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 48, 'column_num': 9}"], {}), "({'line_num': 48, 'column_num': 9})\n", (20533, 20568), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((20890, 20937), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 48, 'column_num': 15}"], {}), "({'line_num': 48, 'column_num': 15})\n", (20901, 20937), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((20966, 21013), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 48, 'column_num': 17}"], {}), "({'line_num': 48, 'column_num': 17})\n", (20977, 21013), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((21423, 21468), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 5, 'column_num': 3}"], {}), "({'line_num': 5, 'column_num': 3})\n", (21434, 21468), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((21495, 21540), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 5, 'column_num': 3}"], {}), "({'line_num': 5, 'column_num': 3})\n", (21506, 21540), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((22132, 22179), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 16}"], {}), "({'line_num': 54, 'column_num': 16})\n", (22143, 22179), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((22208, 22255), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 19}"], {}), "({'line_num': 54, 'column_num': 19})\n", (22219, 22255), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((22598, 22645), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 52}"], {}), "({'line_num': 54, 'column_num': 52})\n", (22609, 22645), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((22674, 22721), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 53}"], {}), "({'line_num': 54, 'column_num': 53})\n", (22685, 22721), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((22892, 22939), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 58}"], {}), "({'line_num': 54, 'column_num': 58})\n", (22903, 22939), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((22968, 23015), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 58}"], {}), "({'line_num': 54, 'column_num': 58})\n", (22979, 23015), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((23338, 23385), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 64}"], {}), "({'line_num': 54, 'column_num': 64})\n", (23349, 23385), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((23414, 23461), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 67}"], {}), "({'line_num': 54, 'column_num': 67})\n", (23425, 23461), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((23931, 23978), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 16}"], {}), "({'line_num': 54, 'column_num': 16})\n", (23942, 23978), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((24007, 24054), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 19}"], {}), "({'line_num': 54, 'column_num': 19})\n", (24018, 24054), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((24397, 24444), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 52}"], {}), "({'line_num': 54, 'column_num': 52})\n", (24408, 24444), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((24473, 24520), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 53}"], {}), "({'line_num': 54, 'column_num': 53})\n", (24484, 24520), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((24691, 24738), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 58}"], {}), "({'line_num': 54, 'column_num': 58})\n", (24702, 24738), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((24767, 24814), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 58}"], {}), "({'line_num': 54, 'column_num': 58})\n", (24778, 24814), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((25137, 25184), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 64}"], {}), "({'line_num': 54, 'column_num': 64})\n", (25148, 25184), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((25213, 25260), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 54, 'column_num': 67}"], {}), "({'line_num': 54, 'column_num': 67})\n", (25224, 25260), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((25676, 25722), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 21, 'column_num': 9}"], {}), "({'line_num': 21, 'column_num': 9})\n", (25687, 25722), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n'), ((25749, 25796), 'hamcrest.has_entries', 'has_entries', (["{'line_num': 21, 'column_num': 11}"], {}), "({'line_num': 21, 'column_num': 11})\n", (25760, 25796), False, 'from hamcrest import assert_that, contains, contains_string, equal_to, has_entries, has_entry, matches_regexp\n')]