当前位置: 首页>>代码示例>>Python>>正文


Python YouCompleteMe._OnCompleteDone_Csharp方法代码示例

本文整理汇总了Python中ycm.youcompleteme.YouCompleteMe._OnCompleteDone_Csharp方法的典型用法代码示例。如果您正苦于以下问题:Python YouCompleteMe._OnCompleteDone_Csharp方法的具体用法?Python YouCompleteMe._OnCompleteDone_Csharp怎么用?Python YouCompleteMe._OnCompleteDone_Csharp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ycm.youcompleteme.YouCompleteMe的用法示例。


在下文中一共展示了YouCompleteMe._OnCompleteDone_Csharp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: PostComplete_test

# 需要导入模块: from ycm.youcompleteme import YouCompleteMe [as 别名]
# 或者: from ycm.youcompleteme.YouCompleteMe import _OnCompleteDone_Csharp [as 别名]

#.........这里部分代码省略.........
      with patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = True ):
        with patch( 'ycm.vimsupport.GetVariableValue',
                    GetVariableValue_CompleteItemIs( 'Te' ) ):
          eq_( [], self.ycm.GetCompletionsUserMayHaveCompleted() )


  def GetCompletionsUserMayHaveCompleted_ReturnMatchIfExactMatches_NewVim_test(
    self, *args ):
    info = [ "NS", "Test", "Abbr", "Menu", "Info", "Kind" ]
    completions = [ BuildCompletion( *info ) ]
    with self._SetupForCsharpCompletionDone( completions ):
      with patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = True ):
        with patch( 'ycm.vimsupport.GetVariableValue',
                    GetVariableValue_CompleteItemIs( *info[ 1: ] ) ):
          eq_( completions, self.ycm.GetCompletionsUserMayHaveCompleted() )


  def GetCompletionsUserMayHaveCompleted_ReturnMatchIfExactMatchesEvenIfPartial_NewVim_test( # noqa
    self, *args ):
    info = [ "NS", "Test", "Abbr", "Menu", "Info", "Kind" ]
    completions = [ BuildCompletion( *info ),
                    BuildCompletion( insertion_text = "TestTest" ) ]
    with self._SetupForCsharpCompletionDone( completions ):
      with patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = True ):
        with patch( 'ycm.vimsupport.GetVariableValue',
                    GetVariableValue_CompleteItemIs( *info[ 1: ] ) ):
          eq_( [ completions[ 0 ] ],
               self.ycm.GetCompletionsUserMayHaveCompleted() )


  def GetCompletionsUserMayHaveCompleted_DontReturnMatchIfNontExactMatchesAndPartial_NewVim_test( # noqa
    self ):
    info = [ "NS", "Test", "Abbr", "Menu", "Info", "Kind" ]
    completions = [ BuildCompletion( insertion_text = info[ 0 ] ),
                    BuildCompletion( insertion_text = "TestTest" ) ]
    with self._SetupForCsharpCompletionDone( completions ):
      with patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = True ):
        with patch( 'ycm.vimsupport.GetVariableValue',
                    GetVariableValue_CompleteItemIs( *info[ 1: ] ) ):
          eq_( [], self.ycm.GetCompletionsUserMayHaveCompleted() )


  def GetCompletionsUserMayHaveCompleted_ReturnMatchIfMatches_NewVim_test(
    self, *args ):
    completions = [ BuildCompletion( None ) ]
    with self._SetupForCsharpCompletionDone( completions ):
      with patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = True ):
        with patch( 'ycm.vimsupport.GetVariableValue',
                    GetVariableValue_CompleteItemIs( "Test" ) ):
          eq_( completions, self.ycm.GetCompletionsUserMayHaveCompleted() )


  def GetCompletionsUserMayHaveCompleted_ReturnMatchIfMatches_OldVim_test(
    self, *args ):
    completions = [ BuildCompletion( None ) ]
    with self._SetupForCsharpCompletionDone( completions ):
      with patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = False ):
        eq_( completions, self.ycm.GetCompletionsUserMayHaveCompleted() )


  def PostCompleteCsharp_EmptyDoesntInsertNamespace_test( self, *args ):
    with self._SetupForCsharpCompletionDone( [] ):
      with patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = False ):
        self.ycm._OnCompleteDone_Csharp()

      ok_( not vimsupport.InsertNamespace.called )


  def PostCompleteCsharp_ExistingWithoutNamespaceDoesntInsertNamespace_test(
    self, *args ):
    completions = [ BuildCompletion( None ) ]
    with self._SetupForCsharpCompletionDone( completions ):
      with patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = False ):
        self.ycm._OnCompleteDone_Csharp()

      ok_( not vimsupport.InsertNamespace.called )


  def PostCompleteCsharp_ValueDoesInsertNamespace_test( self, *args ):
    namespace = "A_NAMESPACE"
    completions = [ BuildCompletion( namespace ) ]
    with self._SetupForCsharpCompletionDone( completions ):
      with patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = False ):
        self.ycm._OnCompleteDone_Csharp()

        vimsupport.InsertNamespace.assert_called_once_with( namespace )

  def PostCompleteCsharp_InsertSecondNamespaceIfSelected_test( self, *args ):
    namespace = "A_NAMESPACE"
    namespace2 = "ANOTHER_NAMESPACE"
    completions = [
      BuildCompletion( namespace ),
      BuildCompletion( namespace2 ),
    ]
    with self._SetupForCsharpCompletionDone( completions ):
      with patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = False ):
        with patch( 'ycm.vimsupport.PresentDialog', return_value = 1 ):
          self.ycm._OnCompleteDone_Csharp()

          vimsupport.InsertNamespace.assert_called_once_with( namespace2 )
开发者ID:0xR,项目名称:YouCompleteMe,代码行数:104,代码来源:postcomplete_tests.py


注:本文中的ycm.youcompleteme.YouCompleteMe._OnCompleteDone_Csharp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。