コード例 #1
0
ファイル: test_idehelper.py プロジェクト: tdavis/pysmell
 def testDetectModuleCompletionInitial(self):
     source = dedent("""\
         from Nested.Package.Mo
         
     """)
     line = "from Nested.Package.Mo"
     options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                     1, len(line), '', NESTEDDICT, update=False)
     expected = CompletionOptions(Types.MODULE, module='Nested.Package', showMembers=False)
     self.assertEquals(options, expected)
     
     source = dedent("""\
         from Module.
         
     """)
     line = "from Module."
     options = detectCompletionType('Module.py', source, 1, len(line), '', self.pysmelldict)
     expected = CompletionOptions(Types.MODULE, module='Module', showMembers=False)
     self.assertEquals(options, expected)
     
     source = dedent("""\
         from Mo
         
     """)
     line = "from Mo"
     options = detectCompletionType('Module.py', source, 1, len(line), '', self.pysmelldict)
     expected = CompletionOptions(Types.MODULE, module='Mo', showMembers=False)
     self.assertEquals(options, expected)
コード例 #2
0
ファイル: test_idehelper.py プロジェクト: tdavis/pysmell
    def testDetectModuleCompletionTwo(self):
        source = dedent("""\
            from Nested.Package import 
            
        """)
        line = "from Nested.Package import "
        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                            1, len(line), '', NESTEDDICT, update=False)
        expected = CompletionOptions(Types.MODULE, module="Nested.Package", showMembers=True)
        self.assertEquals(options, expected)

        source = dedent("""\
            from Nested import 
            
        """)
        line = "from Nested import "
        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                            1, len(line), '', NESTEDDICT, update=False)
        expected = CompletionOptions(Types.MODULE, module="Nested", showMembers=True)
        self.assertEquals(options, expected)

        source = dedent("""\
            from Nested import Pack
            
        """)
        line = "from Nested import Pack"
        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                            1, len(line), '', NESTEDDICT, update=False)
        expected = CompletionOptions(Types.MODULE, module="Nested", showMembers=True)
        self.assertEquals(options, expected)
コード例 #3
0
ファイル: test_idehelper.py プロジェクト: tatwright/pysmell
 def testDetectModuleCompletionInitial(self):
     source = dedent("""\
         from Nested.Package.Mo
         
     """)
     line = "from Nested.Package.Mo"
     options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                     1, len(line), '', NESTEDDICT)
     expected = CompletionOptions(Types.MODULE, module='Nested.Package', showMembers=False)
     self.assertEquals(options, expected)
     
     source = dedent("""\
         from Module.
         
     """)
     line = "from Module."
     options = detectCompletionType('Module.py', source, 1, len(line), '', self.pysmelldict)
     expected = CompletionOptions(Types.MODULE, module='Module', showMembers=False)
     self.assertEquals(options, expected)
     
     source = dedent("""\
         from Mo
         
     """)
     line = "from Mo"
     options = detectCompletionType('Module.py', source, 1, len(line), '', self.pysmelldict)
     expected = CompletionOptions(Types.MODULE, module='Mo', showMembers=False)
     self.assertEquals(options, expected)
コード例 #4
0
ファイル: test_idehelper.py プロジェクト: tatwright/pysmell
    def testDetectModuleCompletionTwo(self):
        source = dedent("""\
            from Nested.Package import 
            
        """)
        line = "from Nested.Package import "
        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                            1, len(line), '', NESTEDDICT)
        expected = CompletionOptions(Types.MODULE, module="Nested.Package", showMembers=True)
        self.assertEquals(options, expected)

        source = dedent("""\
            from Nested import 
            
        """)
        line = "from Nested import "
        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                            1, len(line), '', NESTEDDICT)
        expected = CompletionOptions(Types.MODULE, module="Nested", showMembers=True)
        self.assertEquals(options, expected)

        source = dedent("""\
            from Nested import Pack
            
        """)
        line = "from Nested import Pack"
        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                            1, len(line), '', NESTEDDICT)
        expected = CompletionOptions(Types.MODULE, module="Nested", showMembers=True)
        self.assertEquals(options, expected)
コード例 #5
0
ファイル: textmate.py プロジェクト: skeept/dotvim
def main():
    cur_file = os.environ.get("TM_FILEPATH")
    source = sys.stdin.read()
    line_no = int(os.environ.get("TM_LINE_NUMBER"))
    cur_col = int(os.environ.get("TM_LINE_INDEX"))

    PYSMELLDICT = idehelper.findPYSMELLDICT(cur_file)
    line = source.splitlines()[line_no - 1]
    index = vimhelper.findBase(line, cur_col)
    base = line[index:cur_col]

    options = idehelper.detectCompletionType(cur_file, source, line_no, cur_col, base, PYSMELLDICT)
    completions = idehelper.findCompletions(base, PYSMELLDICT, options)

    if not completions:
        write('No completions found')
        sys.exit(206) #magic code for tooltip
    if len(completions) == 1:
        new_word = completions[0]['word']
        write(new_word)
    elif len(completions) > 1:
        dialogTuples = [
            (
              "%s - %s" % (comp.get('abbr', comp['word']), comp.get('menu', '')),
              index)
            for index, comp in enumerate(completions)
        ]
        compIndex = dialog.menu(dialogTuples)
        if compIndex is not None:
            write(completions[compIndex]['word'])
コード例 #6
0
ファイル: test_idehelper.py プロジェクト: tdavis/pysmell
 def testDetectCompleteArgumentListFunction(self):
     source = dedent("""\
         def a():
           b(
     """)
     line = '  b('
     options = detectCompletionType('path', source, 2, len(line), 'b(', self.pysmelldict)
     expected = CompletionOptions(Types.FUNCTION, name='b', rindex=None)
     self.assertEquals(options, expected)
コード例 #7
0
ファイル: test_idehelper.py プロジェクト: goj/pysmell
 def testDetectCompleteArgumentListFunction(self):
     source = dedent("""\
         def a():
           b(
     """)
     line = '  b('
     options = detectCompletionType('path', source, 2, len(line), 'b(', self.pysmelldict)
     expected = CompletionOptions(Types.FUNCTION, name='b', rindex=None)
     self.assertEquals(options, expected)
コード例 #8
0
 def testDetectCompleteArgumentListMethod(self):
     line = 'salf.bm('
     options = detectCompletionType('path', line, 1, len(line), 'bm(',
                                    self.pysmelldict)
     expected = CompletionOptions(Types.METHOD,
                                  klass=None,
                                  parents=[],
                                  name='bm',
                                  rindex=None)
     self.assertEquals(options, expected)
コード例 #9
0
ファイル: test_idehelper.py プロジェクト: tdavis/pysmell
 def testDetectSimpleClass(self):
     source = dedent("""\
         class aClass(object):
             def sth(self):
                 self.
     
     """)
     line = "%sself." % (' ' * 8)
     options = detectCompletionType('Module.py', source, 3, len(line), '', self.pysmelldict)
     expected = CompletionOptions(Types.INSTANCE, klass='Module.aClass', parents=['object'])
     self.assertEquals(options, expected)
コード例 #10
0
ファイル: test_idehelper.py プロジェクト: tatwright/pysmell
    def testDetectModuleAttrLookup(self):
        source = dedent("""\
            from Nested.Package import Module as mod

            mod.
        """)
        line = "mod."
        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                            3, len(line), '', NESTEDDICT)
        expected = CompletionOptions(Types.MODULE, module="Nested.Package.Module", showMembers=True)
        self.assertEquals(options, expected)
コード例 #11
0
ファイル: test_idehelper.py プロジェクト: tdavis/pysmell
    def testDetectModuleAttrLookup3(self):
        source = dedent("""\
            from Nested import Package

            funct(Package.Module., arg)
        """)
        line = "funct(Package.Module."
        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                            3, len(line), '', NESTEDDICT, update=False)
        expected = CompletionOptions(Types.MODULE, module="Nested.Package.Module", showMembers=True)
        self.assertEquals(options, expected)
コード例 #12
0
    def testDetectModuleAttrLookupWithBase(self):
        source = dedent("""\
            from Nested.Package import Module as mod

            func(mod.some, arg)
        """)
        line = "func(mod.some"
        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                            3, len(line), 'some', NESTEDDICT, update=False)
        expected = CompletionOptions(Types.MODULE, module="Nested.Package.Module", showMembers=True)
        self.assertEquals(options, expected)
コード例 #13
0
 def testDetectCompleteArgumentListFunctionClosingParen(self):
     source = dedent("""\
         def a():
           b()
     """)
     line = '  b()'
     options = detectCompletionType('path', source, 2,
                                    len(line) - 1, 'b(', self.pysmelldict)
     expected = CompletionOptions(Types.FUNCTION, name='b',
                                  rindex=-1)  # module?
     self.assertEqual(options, expected)
コード例 #14
0
ファイル: test_idehelper.py プロジェクト: tatwright/pysmell
    def testModuleCompletionThree(self):
        source = dedent("""\
            import Nested.Package.
            
        """)
        line = "import Nested.Package."
        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                            1, len(line), '', NESTEDDICT)
        expected = CompletionOptions(Types.MODULE, module="Nested.Package", showMembers=False)
        self.assertEquals(options, expected)

        source = dedent("""\
            import Ne
            
        """)
        line = "import Ne"
        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                            1, len(line), '', NESTEDDICT)
        expected = CompletionOptions(Types.MODULE, module="Ne", showMembers=False)
        self.assertEquals(options, expected)
コード例 #15
0
ファイル: test_idehelper.py プロジェクト: tatwright/pysmell
 def testDetectSimpleClass(self):
     source = dedent("""\
         class aClass(object):
             def sth(self):
                 self.
     
     """)
     line = "%sself." % (' ' * 8)
     options = detectCompletionType('Module.py', source, 3, len(line), '', self.pysmelldict)
     expected = CompletionOptions(Types.INSTANCE, klass='Module.aClass', parents=['object'])
     self.assertEquals(options, expected)
コード例 #16
0
ファイル: test_idehelper.py プロジェクト: tdavis/pysmell
    def testDetectClassCreation(self):
        source = dedent("""\
            from Module import aClass

            thing = aClass()
            thing.
        """)
        line = "thing."
        options = detectCompletionType('apath', source,
                                            4, len(line), '', self.pysmelldict)
        expected = CompletionOptions(Types.INSTANCE, klass='Module.aClass', parents=['object', 'ForeignModule.alien'])
        self.assertEquals(options, expected)
コード例 #17
0
ファイル: test_idehelper.py プロジェクト: tatwright/pysmell
    def testDetectClassCreation(self):
        source = dedent("""\
            from Module import aClass

            thing = aClass()
            thing.
        """)
        line = "thing."
        options = detectCompletionType('apath', source,
                                            4, len(line), '', self.pysmelldict)
        expected = CompletionOptions(Types.INSTANCE, klass='Module.aClass', parents=['object', 'ForeignModule.alien'])
        self.assertEquals(options, expected)
コード例 #18
0
ファイル: test_idehelper.py プロジェクト: tatwright/pysmell
 def testDetectDeepClass(self):
     source = dedent("""\
         class Class(object):
             def sth(self):
                 self.
     
     """)
     line = "%sself." % (' ' * 8)
     options = detectCompletionType(os.path.join('Nested', 'Package', 'Module.py'), source,
                         3, len(line), '', NESTEDDICT)
     expected = CompletionOptions(Types.INSTANCE, klass='Nested.Package.Module.Class', parents=['object'])
     self.assertEquals(options, expected)
コード例 #19
0
ファイル: test_idehelper.py プロジェクト: tdavis/pysmell
 def testDetectDeepClass(self):
     source = dedent("""\
         class Class(object):
             def sth(self):
                 self.
     
     """)
     line = "%sself." % (' ' * 8)
     options = detectCompletionType(os.path.join('Nested', 'Package', 'Module.py'), source,
                         3, len(line), '', NESTEDDICT, update=False)
     expected = CompletionOptions(Types.INSTANCE, klass='Nested.Package.Module.Class', parents=['object'])
     self.assertEquals(options, expected)
コード例 #20
0
ファイル: test_idehelper.py プロジェクト: tatwright/pysmell
 def testDetectParentsOfUnknownClass(self):
     source = dedent("""\
         from Nested.Package.Module import Class
         class Other(Class):
             def sth(self):
                 self.
     
     """)
     line = "%sself." % (' ' * 8)
     options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                         4, len(line), '', NESTEDDICT)
     expected = CompletionOptions(Types.INSTANCE, klass='PackageA.Module.Other', parents=['Nested.Package.Module.Class'])
     self.assertEquals(options, expected)
コード例 #21
0
ファイル: test_idehelper.py プロジェクト: tdavis/pysmell
 def testDetectParentsOfUnknownClass(self):
     source = dedent("""\
         from Nested.Package.Module import Class
         class Other(Class):
             def sth(self):
                 self.
     
     """)
     line = "%sself." % (' ' * 8)
     options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                         4, len(line), '', NESTEDDICT, update=False)
     expected = CompletionOptions(Types.INSTANCE, klass='PackageA.Module.Other', parents=['Nested.Package.Module.Class'])
     self.assertEquals(options, expected)
コード例 #22
0
ファイル: test_idehelper.py プロジェクト: goj/pysmell
    def testDetectClassCreationLocal(self):
        source = dedent("""\
            class aClass(object):
                pass

            thing = aClass()
            thing.
        """)
        line = "thing."
        options = detectCompletionType(os.path.abspath('Module.py'), source,
                                            5, len(line), '', self.pysmelldict)
        expected = CompletionOptions(Types.INSTANCE, klass='Module.aClass', parents=['object'])
        self.assertEquals(options, expected)
コード例 #23
0
ファイル: test_idehelper.py プロジェクト: tdavis/pysmell
    def testDetectClassCreationLocal(self):
        source = dedent("""\
            class aClass(object):
                pass

            thing = aClass()
            thing.
        """)
        line = "thing."
        options = detectCompletionType(os.path.abspath('Module.py'), source,
                                            5, len(line), '', self.pysmelldict)
        expected = CompletionOptions(Types.INSTANCE, klass='Module.aClass', parents=['object'])
        self.assertEquals(options, expected)
コード例 #24
0
ファイル: test_idehelper.py プロジェクト: tdavis/pysmell
    def testDetectModuleAttrLookupWithBase2(self):
        print '--------'
        source = dedent("""\
            from Nested.Package import Module as mod

            class Some(object):
                def init(self):
                    self.func(mod.EVT_, self.something)
        """)
        line = "%sself.func(mod.EVT_" % (" " * 8)
        options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'), source,
                                            5, len(line), 'EVT_', NESTEDDICT, update=False)
        expected = CompletionOptions(Types.MODULE, module="Nested.Package.Module", showMembers=True)
        self.assertEquals(options, expected)
コード例 #25
0
ファイル: emacshelper.py プロジェクト: qiuaaron/emacs-config
def get_completions(fullPath, origSource, lineNo, origCol, matcher):
    """arguments: fullPath, origSource, lineNo, origCol, matcher

When visiting the file at fullPath, with edited source origSource, find a list 
of possible completion strings for the symbol located at origCol on orgLineNo using 
matching mode matcher"""
    PYSMELLDICT = idehelper.findPYSMELLDICT(fullPath)
    if not PYSMELLDICT:
        return
    origLine = origSource.splitlines()[lineNo - 1]
    base = split("[,.\-+/|\[\]]", origLine[:origCol].strip())[-1]
    options = idehelper.detectCompletionType(fullPath, origSource, lineNo, origCol, base, PYSMELLDICT)
    completions = [completion['word'] for completion in idehelper.findCompletions(base, PYSMELLDICT, options, matcher)]
    completions = list(_uniquify(completions))
    return completions
コード例 #26
0
    def testModuleCompletionThree(self):
        source = dedent("""\
            import Nested.Package.
            
        """)
        line = "import Nested.Package."
        options = detectCompletionType(os.path.join('TestData', 'PackageA',
                                                    'Module.py'),
                                       source,
                                       1,
                                       len(line),
                                       '',
                                       NESTEDDICT,
                                       update=False)
        expected = CompletionOptions(Types.MODULE,
                                     module="Nested.Package",
                                     showMembers=False)
        self.assertEqual(options, expected)

        source = dedent("""\
            import Ne
            
        """)
        line = "import Ne"
        options = detectCompletionType(os.path.join('TestData', 'PackageA',
                                                    'Module.py'),
                                       source,
                                       1,
                                       len(line),
                                       '',
                                       NESTEDDICT,
                                       update=False)
        expected = CompletionOptions(Types.MODULE,
                                     module="Ne",
                                     showMembers=False)
        self.assertEqual(options, expected)
コード例 #27
0
ファイル: test_idehelper.py プロジェクト: goj/pysmell
 def testInferShouldUpdatePYSMELLDICT(self):
     source = dedent("""\
         from Nested.Package.Module import Class
         class FreshClass(Class):
             something = 1
             def sth(self):
                 self.
     
     """)
     line = "%sself." % (' ' * 8)
     copiedDict = copy.deepcopy(self.pysmelldict)
     assert copiedDict == self.pysmelldict
     options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'),
         source, 5, len(line), '', copiedDict)
     expected = CompletionOptions(Types.INSTANCE, klass='PackageA.Module.FreshClass', parents=['Nested.Package.Module.Class'])
     self.assertEquals(options, expected) #sanity
     klass = copiedDict['CLASSES']['PackageA.Module.FreshClass']
     self.assertEquals(klass['bases'], ['Nested.Package.Module.Class'])
     self.assertEquals(klass['properties'], ['something'])
     self.assertEquals(klass['methods'], [('sth', [], "")])
コード例 #28
0
ファイル: emacshelper.py プロジェクト: wankata/pysmell
def get_completions(fullPath, origSource, lineNo, origCol, matcher):
    """arguments: fullPath, origSource, lineNo, origCol, matcher

When visiting the file at fullPath, with edited source origSource, find a list 
of possible completion strings for the symbol located at origCol on orgLineNo using 
matching mode matcher"""
    PYSMELLDICT = idehelper.findPYSMELLDICT(fullPath)
    if not PYSMELLDICT:
        return
    origLine = origSource.splitlines()[lineNo - 1]
    base = split("[,.\-+/|\[\]]", origLine[:origCol].strip())[-1]
    options = idehelper.detectCompletionType(fullPath, origSource, lineNo, origCol, base, PYSMELLDICT)
    completions = [completion['word'] for completion in idehelper.findCompletions(base, PYSMELLDICT, options, matcher)]
    completions = list(_uniquify(completions))
    return completions




        
コード例 #29
0
ファイル: test_idehelper.py プロジェクト: tdavis/pysmell
 def testInferShouldUpdatePYSMELLDICT(self):
     source = dedent("""\
         from Nested.Package.Module import Class
         class FreshClass(Class):
             something = 1
             def sth(self):
                 self.
     
     """)
     line = "%sself." % (' ' * 8)
     copiedDict = copy.deepcopy(self.pysmelldict)
     assert copiedDict == self.pysmelldict
     options = detectCompletionType(os.path.join('TestData', 'PackageA', 'Module.py'),
         source, 5, len(line), '', copiedDict)
     expected = CompletionOptions(Types.INSTANCE, klass='PackageA.Module.FreshClass', parents=['Nested.Package.Module.Class'])
     self.assertEquals(options, expected) #sanity
     klass = copiedDict['CLASSES']['PackageA.Module.FreshClass']
     self.assertEquals(klass['bases'], ['Nested.Package.Module.Class'])
     self.assertEquals(klass['properties'], ['something'])
     self.assertEquals(klass['methods'], [('sth', [], "")])
コード例 #30
0
def _main(cur_file, line_no, cur_col):
    if not cur_file:
        write('No filename - is the file saved?')
        return TOOLTIP
    source = sys.stdin.read()

    PYSMELLDICT = idehelper.findPYSMELLDICT(cur_file)
    if PYSMELLDICT is None:
        write('No PYSMELLTAGS found - you have to generate one.')
        return TOOLTIP
    line = source.splitlines()[line_no - 1]
    index = idehelper.findBase(line, cur_col)
    base = line[index:cur_col]

    options = idehelper.detectCompletionType(cur_file, source, line_no,
                                             cur_col, base, PYSMELLDICT)
    completions = idehelper.findCompletions(base, PYSMELLDICT, options)

    if not completions:
        write('No completions found')
        return TOOLTIP
    if len(completions) == 1:
        new_word = completions[0]['word']
        write(new_word[len(base):])
    elif len(completions) > 1:
        dialogTuples = [
            ("%s - %s" %
             (comp.get('abbr', comp['word']), comp.get('menu', '')), index)
            for index, comp in enumerate(completions)
        ]
        try:
            compIndex = tm_dialog.menu(dialogTuples)
        except Exception as e:
            import traceback
            write(traceback.format_exc(e))
            return TOOLTIP
        if compIndex is not None:
            write(completions[compIndex]['word'][len(base):])
コード例 #31
0
ファイル: textmate.py プロジェクト: LunarBiscuit/pysmell
def _main(cur_file, line_no, cur_col):
    if not cur_file:
        write('No filename - is the file saved?')
        return TOOLTIP
    source = sys.stdin.read()

    PYSMELLDICT = idehelper.findPYSMELLDICT(cur_file)
    if PYSMELLDICT is None:
        write('No PYSMELLTAGS found - you have to generate one.')
        return TOOLTIP
    line = source.splitlines()[line_no - 1]
    index = idehelper.findBase(line, cur_col)
    base = line[index:cur_col]

    options = idehelper.detectCompletionType(cur_file, source, line_no, cur_col, base, PYSMELLDICT)
    completions = idehelper.findCompletions(base, PYSMELLDICT, options)

    if not completions:
        write('No completions found')
        return TOOLTIP
    if len(completions) == 1:
        new_word = completions[0]['word']
        write(new_word[len(base):])
    elif len(completions) > 1:
        dialogTuples = [
            (
              "%s - %s" % (comp.get('abbr', comp['word']), comp.get('menu', '')),
              index)
            for index, comp in enumerate(completions)
        ]
        try:
            compIndex = tm_dialog.menu(dialogTuples)
        except Exception, e:
            import traceback
            write(traceback.format_exc(e))
            return TOOLTIP
        if compIndex is not None:
            write(completions[compIndex]['word'][len(base):])
コード例 #32
0
 def testDetectGlobalLookup(self):
     options = detectCompletionType('path', 'b', 1, 1, 'b',
                                    self.pysmelldict)
     expected = CompletionOptions(Types.TOPLEVEL)
     self.assertEquals(options, expected)
コード例 #33
0
 def testDetectAttrLookup(self):
     line = 'somethign.a'
     options = detectCompletionType('path', line, 1, len(line), 'a',
                                    self.pysmelldict)
     expected = CompletionOptions(Types.INSTANCE, klass=None, parents=[])
     self.assertEquals(options, expected)
コード例 #34
0
ファイル: test_idehelper.py プロジェクト: tatwright/pysmell
 def testDetectCompleteArgumentListMethod(self):
     line = 'salf.bm('
     options = detectCompletionType('', line, 1, len(line), 'bm(', self.pysmelldict)
     expected = CompletionOptions(Types.METHOD, klass=None, parents=[], name='bm', rindex = None)
     self.assertEquals(options, expected)
コード例 #35
0
ファイル: test_idehelper.py プロジェクト: tatwright/pysmell
 def testDetectCompleteArgumentListFunctionClosingParen(self):
     line = '   b()'
     options = detectCompletionType('', line, 1, len(line) - 1, 'b(', self.pysmelldict)
     expected = CompletionOptions(Types.FUNCTION, name='b', rindex=-1)# module?
     self.assertEquals(options, expected)
コード例 #36
0
ファイル: test_idehelper.py プロジェクト: tatwright/pysmell
 def testDetectCompleteArgumentListFunction(self):
     line = '  b('
     options = detectCompletionType('', line, 1, len(line), 'b(', self.pysmelldict)
     expected = CompletionOptions(Types.FUNCTION, name='b', rindex=None)
     self.assertEquals(options, expected)
コード例 #37
0
ファイル: test_idehelper.py プロジェクト: tatwright/pysmell
 def testDetectGlobalLookup(self):
     options = detectCompletionType('', 'b', 1, 1, 'b', self.pysmelldict)
     expected = CompletionOptions(Types.TOPLEVEL)
     self.assertEquals(options, expected)
コード例 #38
0
ファイル: test_idehelper.py プロジェクト: tatwright/pysmell
 def testDetectAttrLookup(self):
     line = 'somethign.a'
     options = detectCompletionType('', line, 1, len(line), 'a', self.pysmelldict)
     expected = CompletionOptions(Types.INSTANCE, klass=None, parents=[])
     self.assertEquals(options, expected)