def Subcommands_GetDoc_Method_test( app ): # Testcase1 filepath = PathToTestFile( 'GetDoc.py' ) contents = ReadFile( filepath ) event_data = BuildRequest( filepath = filepath, filetype = 'python', line_num = 17, column_num = 9, contents = contents, command_arguments = [ 'GetDoc' ], completer_target = 'filetype_default' ) response = app.post_json( '/run_completer_command', event_data ).json eq_( response, { 'detailed_info': '_ModuleMethod()\n\n' 'Module method docs\n' 'Are dedented, like you might expect', } )
def PollForMessages_ServerNotRunning_test(app): StartJavaCompleterServerInDirectory( app, PathToTestFile('simple_eclipse_project')) filepath = TestFactory contents = ReadFile(filepath) app.post_json( '/run_completer_command', BuildRequest( filetype='java', command_arguments=['StopServer'], ), ) response = app.post_json( '/receive_messages', BuildRequest(filetype='java', filepath=filepath, contents=contents)).json assert_that(response, equal_to(False))
def Subcommands_CsCompleter_InvalidLocation_test( app ): filepath = PathToTestFile( 'testy', 'GotoTestCase.cs' ) with WrapOmniSharpServer( app, filepath ): contents = ReadFile( filepath ) goto_data = BuildRequest( completer_target = 'filetype_default', command_arguments = [ 'GoToImplementation' ], line_num = 3, column_num = 1, contents = contents, filetype = 'cs', filepath = filepath ) response = app.post_json( '/run_completer_command', goto_data, expect_errors = True ).json assert_that( response, ErrorMatcher( RuntimeError, "Can't jump to implementation" ) )
def Subcommands_GoToImplementationElseDeclaration_MultipleImplementations_test( app ): filepath = PathToTestFile( 'testy', 'GotoTestCase.cs' ) with WrapOmniSharpServer( app, filepath ): contents = ReadFile( filepath ) goto_data = BuildRequest( completer_target = 'filetype_default', command_arguments = [ 'GoToImplementationElseDeclaration' ], line_num = 22, column_num = 13, contents = contents, filetype = 'cs', filepath = filepath ) response = app.post_json( '/run_completer_command', goto_data ).json assert_that( response, contains_exactly( LocationMatcher( filepath, 44, 15 ), LocationMatcher( filepath, 49, 15 ) ) )
def Subcommands_GoToImplementation_Basic_test(app): filepath = PathToTestFile('testy', 'GotoTestCase.cs') with WrapOmniSharpServer(app, filepath): contents = ReadFile(filepath) goto_data = BuildRequest(completer_target='filetype_default', command_arguments=['GoToImplementation'], line_num=14, column_num=13, contents=contents, filetype='cs', filepath=filepath) eq_( { 'filepath': PathToTestFile('testy', 'GotoTestCase.cs'), 'line_num': 31, 'column_num': 15 }, app.post_json('/run_completer_command', goto_data).json)
def Subcommands_GetDoc_Variable_test(app): filepath = PathToTestFile('testy', 'GetDocTestCase.cs') with WrapOmniSharpServer(app, filepath): contents = ReadFile(filepath) getdoc_data = BuildRequest(completer_target='filetype_default', command_arguments=['GetDoc'], line_num=13, column_num=28, contents=contents, filetype='cs', filepath=filepath) eq_( { 'detailed_info': 'int GetDocTestCase.an_int\n' 'an integer, or something', }, app.post_json('/run_completer_command', getdoc_data).json)
def Subcommands_GoTo_Unicode_test(app): filepath = PathToTestFile('testy', 'Unicode.cs') with WrapOmniSharpServer(app, filepath): contents = ReadFile(filepath) goto_data = BuildRequest(completer_target='filetype_default', command_arguments=['GoTo'], line_num=45, column_num=43, contents=contents, filetype='cs', filepath=filepath) eq_( { 'filepath': PathToTestFile('testy', 'Unicode.cs'), 'line_num': 30, 'column_num': 54 }, app.post_json('/run_completer_command', goto_data).json)
def test_Subcommands_GoToReferences_Builtin(self, app): filepath = PathToTestFile('goto', 'references.py') contents = ReadFile(filepath) command_data = BuildRequest(filepath=filepath, filetype='python', line_num=8, column_num=1, contents=contents, command_arguments=['GoToReferences']) assert_that( app.post_json('/run_completer_command', command_data).json, has_item( has_entries({ 'filepath': filepath, 'line_num': 8, 'column_num': 1, 'description': 'str' })))
def SignatureHelp_NotAFunction_NoError_test( app ): filepath = PathToTestFile( 'testy', 'ContinuousTest.cs' ) contents = ReadFile( filepath ) request = BuildRequest( line_num = 19, column_num = 7, filetypes = [ 'cs' ], filepath = filepath, contents = contents ) with WrapOmniSharpServer( app, filepath ): response = app.post_json( '/signature_help', request ).json LOGGER.debug( 'response = %s', response ) assert_that( response, has_entries( { 'errors': empty(), 'signature_help': has_entries( { 'activeSignature': 0, 'activeParameter': 0, 'signatures': empty() } ) } ) )
def Subcommands_GetDoc_Function_test(app): filepath = PathToTestFile('testy', 'GetDocTestCase.cs') with WrapOmniSharpServer(app, filepath): contents = ReadFile(filepath) getdoc_data = BuildRequest(completer_target='filetype_default', command_arguments=['GetDoc'], line_num=33, column_num=27, contents=contents, filetype='cs', filepath=filepath) response = app.post_json('/run_completer_command', getdoc_data).json assert_that( response, has_entry( 'detailed_info', 'int GetDocTestCase.DoATest()\n' 'Very important method.\n\nWith multiple lines of ' 'commentary\nAnd Format-\n-ting'))
def Subcommands_RefactorRename_MissingNewName_test(app): continuous_test = PathToTestFile('testy', 'ContinuousTest.cs') with WrapOmniSharpServer(app, continuous_test): contents = ReadFile(continuous_test) request = BuildRequest(completer_target='filetype_default', command_arguments=['RefactorRename'], line_num=5, column_num=15, contents=contents, filetype='cs', filepath=continuous_test) response = app.post_json('/run_completer_command', request, expect_errors=True).json assert_that( response, ErrorMatcher( ValueError, 'Please specify a new name to rename it to.\n' 'Usage: RefactorRename <new name>'))
def DebugInfo_ServerIsNotRunning_LogfilesDoNotExist_test(app): with UserOption('server_keep_logfiles', False): filepath = PathToTestFile('testy', 'Program.cs') contents = ReadFile(filepath) event_data = BuildRequest(filepath=filepath, filetype='cs', contents=contents, event_name='FileReadyToParse') app.post_json('/event_notification', event_data) WaitUntilCompleterServerReady(app, 'cs') StopCompleterServer(app, 'cs', filepath) request_data = BuildRequest(filepath=filepath, filetype='cs') assert_that( app.post_json('/debug_info', request_data).json, matches_regexp('C# completer debug information:\n' ' OmniSharp is not running\n' ' OmniSharp executable: .+\n' ' OmniSharp solution: .+'))
def Diagnostics_Poll_test(app): filepath = PathToTestFile('common', 'src', 'main.rs') contents = ReadFile(filepath) # Poll until we receive _all_ the diags asynchronously. to_see = sorted(DIAG_MATCHERS_PER_FILE.keys()) seen = {} try: for message in PollForMessages(app, { 'filepath': filepath, 'contents': contents, 'filetype': 'rust' }): print('Message {}'.format(pformat(message))) if 'diagnostics' in message: seen[message['filepath']] = True if message['filepath'] not in DIAG_MATCHERS_PER_FILE: raise AssertionError( 'Received diagnostics for unexpected file {}. ' 'Only expected {}'.format(message['filepath'], to_see)) assert_that( message, has_entries({ 'diagnostics': DIAG_MATCHERS_PER_FILE[message['filepath']], 'filepath': message['filepath'] })) if sorted(seen.keys()) == to_see: break # Eventually PollForMessages will throw a timeout exception and we'll fail # if we don't see all of the expected diags. except PollForMessagesTimeoutException as e: raise AssertionError( str(e) + 'Timed out waiting for full set of diagnostics. ' 'Expected to see diags for {}, but only saw {}.'.format( json.dumps(to_see, indent=2), json.dumps(sorted(seen.keys()), indent=2)))
def test_Diagnostics_MaximumDiagnosticsNumberExceeded(self, app): filepath = PathToTestFile('testy', 'MaxDiagnostics.cs') with WrapOmniSharpServer(app, filepath): contents = ReadFile(filepath) event_data = BuildRequest(filepath=filepath, event_name='FileReadyToParse', filetype='cs', contents=contents) results = app.post_json('/event_notification', event_data).json assert_that( results, contains_exactly( has_entries({ 'kind': equal_to('ERROR'), 'text': contains_string( "The type 'MaxDiagnostics' already contains " "a definition for 'test'"), 'location': LocationMatcher(filepath, 4, 16), 'location_extent': RangeMatcher(filepath, (4, 16), (4, 20)) }), has_entries({ 'kind': equal_to('ERROR'), 'text': contains_string( 'Maximum number of diagnostics exceeded.'), 'location': LocationMatcher(filepath, 1, 1), 'location_extent': RangeMatcher(filepath, (1, 1), (1, 1)), 'ranges': contains_exactly(RangeMatcher(filepath, (1, 1), (1, 1))) })))
def test_Subcommands_RefactorRename_Module(self, app): one = PathToTestFile('rename', 'one.py') two = PathToTestFile('rename', 'two.py') contents = ReadFile(two) command_data = BuildRequest( filepath=two, filetype='python', line_num=1, column_num=8, contents=contents, command_arguments=['RefactorRename', 'pfivr']) response = app.post_json('/run_completer_command', command_data).json assert_that( response, has_entries({ 'fixits': contains_exactly( has_entries({ 'text': '', 'chunks': contains_exactly( ChunkMatcher('pfivr', LocationMatcher(two, 1, 8), LocationMatcher(two, 1, 11)), ChunkMatcher('pfivr', LocationMatcher(two, 4, 12), LocationMatcher(two, 4, 15))), 'files': contains_exactly( has_entries({ 'operation': 'RENAME', 'old_file': one, 'new_file': PathToTestFile('rename', 'pfivr.py') })) })) }))
def GetCompletions_AfterRestart_test(app): filepath = PathToTestFile('test.ts') app.post_json( '/run_completer_command', BuildRequest(completer_target='filetype_default', command_arguments=['RestartServer'], filetype='typescript', filepath=filepath)) completion_data = BuildRequest(filepath=filepath, filetype='typescript', contents=ReadFile(filepath), force_semantic=True, line_num=17, column_num=6) response = app.post_json('/completions', completion_data) assert_that( response.json, has_entries({ 'completions': contains_inanyorder( CompletionEntryMatcher( 'methodA', extra_params={ 'menu_text': 'methodA (method) Foo.methodA(): void' }), CompletionEntryMatcher( 'methodB', extra_params={ 'menu_text': 'methodB (method) Foo.methodB(): void' }), CompletionEntryMatcher( 'methodC', extra_params={ 'menu_text': ('methodC (method) Foo.methodC(a: ' '{ foo: string; bar: number; }): void') }), ) }))
def StopServer_KeepLogFiles( app ): filepath = PathToTestFile( 'testy', 'GotoTestCase.cs' ) contents = ReadFile( filepath ) event_data = BuildRequest( filepath = filepath, filetype = 'cs', contents = contents, event_name = 'FileReadyToParse' ) app.post_json( '/event_notification', event_data ) WaitUntilCompleterServerReady( app, 'cs' ) event_data = BuildRequest( filetype = 'cs', filepath = filepath ) response = app.post_json( '/debug_info', event_data ).json logfiles = [] for server in response[ 'completer' ][ 'servers' ]: logfiles.extend( server[ 'logfiles' ] ) try: for logfile in logfiles: ok_( os.path.exists( logfile ), 'Logfile should exist at {0}'.format( logfile ) ) finally: app.post_json( '/run_completer_command', BuildRequest( filetype = 'cs', filepath = filepath, command_arguments = [ 'StopServer' ] ) ) if user_options_store.Value( 'server_keep_logfiles' ): for logfile in logfiles: ok_( os.path.exists( logfile ), 'Logfile should still exist at {0}'.format( logfile ) ) else: for logfile in logfiles: ok_( not os.path.exists( logfile ), 'Logfile should no longer exist at {0}'.format( logfile ) )
def RunTest(app, test): contents = ReadFile(test['request']['filepath']) app.post_json( '/event_notification', CombineRequest( test['request'], { 'contents': contents, 'filetype': 'typescript', 'event_name': 'BufferVisit' })) app.post_json( '/event_notification', CombineRequest( test['request'], { 'contents': contents, 'filetype': 'typescript', 'event_name': 'FileReadyToParse' })) # We ignore errors here and check the response code ourself. # This is to allow testing of requests returning errors. response = app.post_json('/run_completer_command', CombineRequest( test['request'], { 'contents': contents, 'filetype': 'typescript', 'command_arguments': ([test['request']['command']] + test['request'].get('arguments', [])) }), expect_errors=True) print(f'completer response: { pprint.pformat( response.json ) }') assert_that(response.status_code, equal_to(test['expect']['response'])) assert_that(response.json, test['expect']['data'])
def Diagnostics_ZeroBasedLineAndColumn_test(app): filepath = PathToTestFile('testy', 'Program.cs') with WrapOmniSharpServer(app, filepath): contents = ReadFile(filepath) for _ in (0, 1): # First call always returns blank for some reason event_data = BuildRequest(filepath=filepath, event_name='FileReadyToParse', filetype='cs', contents=contents) results = app.post_json('/event_notification', event_data).json assert_that( results, contains( has_entries({ 'kind': equal_to('ERROR'), 'text': contains_string( "Unexpected symbol `}'', expecting identifier"), 'location': has_entries({ 'line_num': 11, 'column_num': 2 }), 'location_extent': has_entries({ 'start': has_entries({ 'line_num': 11, 'column_num': 2, }), 'end': has_entries({ 'line_num': 11, 'column_num': 2, }), }) })))
def FileReadyToParse_Diagnostics_InvalidURI_test(app, uri_to_filepath, *args): StartJavaCompleterServerInDirectory(app, PathToTestFile(DEFAULT_PROJECT_DIR)) filepath = TestFactory contents = ReadFile(filepath) # It can take a while for the diagnostics to be ready expiration = time.time() + 10 while True: try: results = _WaitForDiagnosticsToBeReady(app, filepath, contents) print('Completer response: {0}'.format( json.dumps(results, indent=2))) uri_to_filepath.assert_called() assert_that( results, has_item( has_entries({ 'kind': 'WARNING', 'text': 'The value of the field TestFactory.Bar.testString is not ' 'used', 'location': LocationMatcher('', 15, 19), 'location_extent': RangeMatcher('', (15, 19), (15, 29)), 'ranges': contains(RangeMatcher('', (15, 19), (15, 29))), 'fixit_available': False }), )) return except AssertionError: if time.time() > expiration: raise time.sleep(0.25)
def Diagnostics_WithRange_test(app): filepath = PathToTestFile('testy', 'DiagnosticRange.cs') with WrapOmniSharpServer(app, filepath): contents = ReadFile(filepath) results = {} for _ in (0, 1): # First call always returns blank for some reason event_data = BuildRequest(filepath=filepath, event_name='FileReadyToParse', filetype='cs', contents=contents) results = app.post_json('/event_notification', event_data).json assert_that( results, contains( has_entries({ 'kind': equal_to('WARNING'), 'text': contains_string("Name should have prefix '_'"), 'location': has_entries({ 'line_num': 3, 'column_num': 16 }), 'location_extent': has_entries({ 'start': has_entries({ 'line_num': 3, 'column_num': 16, }), 'end': has_entries({ 'line_num': 3, 'column_num': 25, }), }) })))
def Poll_Diagnostics_ProjectWide_Eclipse_test( app ): filepath = TestLauncher contents = ReadFile( filepath ) # Poll until we receive _all_ the diags asynchronously to_see = sorted( iterkeys( DIAG_MATCHERS_PER_FILE ) ) seen = {} try: for message in PollForMessages( app, { 'filepath': filepath, 'contents': contents, 'filetype': 'java' } ): print( 'Message {0}'.format( pformat( message ) ) ) if 'diagnostics' in message: seen[ message[ 'filepath' ] ] = True if message[ 'filepath' ] not in DIAG_MATCHERS_PER_FILE: raise AssertionError( 'Received diagnostics for unexpected file {0}. ' 'Only expected {1}'.format( message[ 'filepath' ], to_see ) ) assert_that( message, has_entries( { 'diagnostics': DIAG_MATCHERS_PER_FILE[ message[ 'filepath' ] ], 'filepath': message[ 'filepath' ] } ) ) if sorted( iterkeys( seen ) ) == to_see: break else: print( 'Seen diagnostics for {0}, still waiting for {1}'.format( json.dumps( sorted( iterkeys( seen ) ), indent=2 ), json.dumps( [ x for x in to_see if x not in seen ], indent=2 ) ) ) # Eventually PollForMessages will throw a timeout exception and we'll fail # if we don't see all of the expected diags except PollForMessagesTimeoutException as e: raise AssertionError( str( e ) + 'Timed out waiting for full set of diagnostics. ' 'Expected to see diags for {0}, but only saw {1}.'.format( json.dumps( to_see, indent=2 ), json.dumps( sorted( iterkeys( seen ) ), indent=2 ) ) )
def GetCompletions_ForcedDividesCache_test( app ): filepath = PathToTestFile( 'testy', 'ContinuousTest.cs' ) with WrapOmniSharpServer( app, filepath ): contents = ReadFile( filepath ) event_data = BuildRequest( filepath = filepath, filetype = 'cs', contents = contents, event_name = 'FileReadyToParse' ) app.post_json( '/event_notification', event_data ) completion_data = BuildRequest( filepath = filepath, filetype = 'cs', contents = contents, line_num = 9, column_num = 21, force_semantic = True, query = 'Date' ) results = app.post_json( '/completions', completion_data ).json assert_that( results[ 'completions' ], not( empty() ) ) assert_that( results[ 'errors' ], empty() ) completion_data = BuildRequest( filepath = filepath, filetype = 'cs', contents = contents, line_num = 9, column_num = 21, force_semantic = False, query = 'Date' ) results = app.post_json( '/completions', completion_data ).json # There are no semantic completions. However, we fall back to identifier # completer in this case. assert_that( results, has_entries( { 'completions': has_item( has_entries( { 'insertion_text' : 'String', 'extra_menu_info': '[ID]', } ) ), 'errors': empty(), } ) )
def RunTest( app, test ): filepath = PathToTestFile( 'test.ts' ) contents = ReadFile( filepath ) event_data = BuildRequest( filepath = filepath, filetype = 'typescript', contents = contents, event_name = 'BufferVisit' ) app.post_json( '/event_notification', event_data ) completion_data = BuildRequest( filepath = filepath, filetype = 'typescript', contents = contents, force_semantic = True, line_num = 17, column_num = 6 ) response = app.post_json( '/completions', completion_data ) assert_that( response.json, test[ 'expect' ][ 'data' ] )
def Subcommands_GetType_Basic_test(app): filepath = PathToTestFile('test.ts') contents = ReadFile(filepath) event_data = BuildRequest(filepath=filepath, filetype='typescript', contents=contents, event_name='BufferVisit') app.post_json('/event_notification', event_data) gettype_data = BuildRequest(completer_target='filetype_default', command_arguments=['GetType'], line_num=17, column_num=1, contents=contents, filetype='typescript', filepath=filepath) response = app.post_json('/run_completer_command', gettype_data).json assert_that(response, MessageMatcher('var foo: Foo'))
def RunTest( app, test ): contents = ReadFile( test[ 'request' ][ 'filepath' ] ) # We ignore errors here and check the response code ourself. # This is to allow testing of requests returning errors. response = app.post_json( '/run_completer_command', CombineRequest( test[ 'request' ], { 'contents': contents, 'filetype': 'python', 'command_arguments': ( [ test[ 'request' ][ 'command' ] ] + test[ 'request' ].get( 'arguments', [] ) ) } ), expect_errors = True ) print( 'completer response: {0}'.format( pformat( response.json ) ) ) eq_( response.status_code, test[ 'expect' ][ 'response' ] ) assert_that( response.json, test[ 'expect' ][ 'data' ] )
def Subcommands_GoToImplementation_NoImplementation_test(app): filepath = PathToTestFile('testy', 'GotoTestCase.cs') with WrapOmniSharpServer(app, filepath): contents = ReadFile(filepath) goto_data = BuildRequest(completer_target='filetype_default', command_arguments=['GoToImplementation'], line_num=17, column_num=13, contents=contents, filetype='cs', filepath=filepath) try: app.post_json('/run_completer_command', goto_data).json raise Exception("Expected a 'No implementations found' error") except AppError as e: if 'No implementations found' in str(e): pass else: raise
def Diagnostics_DetailedDiagnostics_test(app): filepath = PathToTestFile('test.ts') contents = ReadFile(filepath) event_data = BuildRequest(filepath=filepath, filetype='typescript', contents=contents, event_name='BufferVisit') app.post_json('/event_notification', event_data) diagnostic_data = BuildRequest(filepath=filepath, filetype='typescript', contents=contents, line_num=35, column_num=6) assert_that( app.post_json('/detailed_diagnostic', diagnostic_data).json, has_entry( 'message', "Property 'nonExistingMethod' does not exist on type 'Bar'."))
def Subcommands_GetDoc_NoCursor_test( app ): filepath = PathToTestFile( 'GetDoc_Clang.cc' ) contents = ReadFile( filepath ) event_data = BuildRequest( filepath = filepath, filetype = 'cpp', compilation_flags = [ '-x', 'c++' ], line_num = 1, column_num = 1, contents = contents, command_arguments = [ 'GetDoc' ], completer_target = 'filetype_default' ) response = app.post_json( '/run_completer_command', event_data, expect_errors = True ) eq_( response.status_code, requests.codes.internal_server_error ) assert_that( response.json, ErrorMatcher( ValueError, NO_DOCUMENTATION_MESSAGE ) )
def Subcommands_GetType_Method_test( app ): filepath = PathToTestFile( 'simple_eclipse_project', 'src', 'com', 'test', 'TestWidgetImpl.java' ) contents = ReadFile( filepath ) event_data = BuildRequest( filepath = filepath, filetype = 'java', line_num = 20, column_num = 15, contents = contents, command_arguments = [ 'GetType' ], completer_target = 'filetype_default' ) response = app.post_json( '/run_completer_command', event_data ).json eq_( response, { 'message': 'void com.test.TestWidgetImpl.doSomethingVaguelyUseful()' } )
def EventNotification_OnBufferUnload_CloseFile_test( app ): # Open main.ts file in a buffer. main_filepath = PathToTestFile( 'buffer_unload', 'main.ts' ) main_contents = ReadFile( main_filepath ) event_data = BuildRequest( filepath = main_filepath, filetype = 'typescript', contents = main_contents, event_name = 'BufferVisit' ) app.post_json( '/event_notification', event_data ) # Complete in main.ts buffer an object defined in imported.ts. completion_data = BuildRequest( filepath = main_filepath, filetype = 'typescript', contents = main_contents, line_num = 3, column_num = 10 ) response = app.post_json( '/completions', completion_data ) assert_that( response.json, has_entries( { 'completions': contains( CompletionEntryMatcher( 'method' ) ) } ) ) # Open imported.ts file in another buffer. imported_filepath = PathToTestFile( 'buffer_unload', 'imported.ts' ) imported_contents = ReadFile( imported_filepath ) event_data = BuildRequest( filepath = imported_filepath, filetype = 'typescript', contents = imported_contents, event_name = 'BufferVisit' ) app.post_json( '/event_notification', event_data ) # Modify imported.ts buffer without writing the changes to disk. modified_imported_contents = imported_contents.replace( 'method', 'modified_method' ) # FIXME: TypeScript completer should not rely on the FileReadyToParse events # to synchronize the contents of dirty buffers but use instead the file_data # field of the request. event_data = BuildRequest( filepath = imported_filepath, filetype = 'typescript', contents = modified_imported_contents, event_name = 'FileReadyToParse' ) app.post_json( '/event_notification', event_data ) # Complete at same location in main.ts buffer. imported_data = { imported_filepath: { 'filetypes': [ 'typescript' ], 'contents': modified_imported_contents } } completion_data = BuildRequest( filepath = main_filepath, filetype = 'typescript', contents = main_contents, line_num = 3, column_num = 10, file_data = imported_data ) response = app.post_json( '/completions', completion_data ) assert_that( response.json, has_entries( { 'completions': contains( CompletionEntryMatcher( 'modified_method' ) ) } ) ) # Unload imported.ts buffer. event_data = BuildRequest( filepath = imported_filepath, filetype = 'typescript', contents = imported_contents, event_name = 'BufferUnload' ) app.post_json( '/event_notification', event_data ) # Complete at same location in main.ts buffer. completion_data = BuildRequest( filepath = main_filepath, filetype = 'typescript', contents = main_contents, line_num = 3, column_num = 10 ) response = app.post_json( '/completions', completion_data ) assert_that( response.json, has_entries( { 'completions': contains( CompletionEntryMatcher( 'method' ) ) } ) )