def helper(self, src, classsrc, line, col):
     try:
         createPackageStructure(src,classsrc)
         filename = pkgstructureFile2
         refs = [x for x in findReferences(filename,line,col)]
     finally:
         removePackageStructure()
     return refs
Example #2
0
 def helper(self, src, classsrc, line, col):
     try:
         createPackageStructure(src, classsrc)
         filename = pkgstructureFile2
         refs = [x for x in findReferences(filename, line, col)]
     finally:
         removePackageStructure()
     return refs
Example #3
0
 def helper4(self, src, importedsrc, line, col):
     createPackageStructure(src, importedsrc)
     filename = pkgstructureFile1
     refs = [
         x for x in findReferences(filename, line, col)
         if x.confidence == 100
     ]
     return refs
Example #4
0
    def test_returnsOtherFilesInSameNonPackageDirectory(self):
        try:
            classsrc = trimLines("""
            def testFunction():
                print 'hello'
            """)
            src = trimLines("""
            from baz import testFunction
            """)
            writeTmpTestFile(src)
            newtmpfile = os.path.join(tmproot,"baz.py")
            writeFile(newtmpfile, classsrc)
            refs = [x for x in findReferences(newtmpfile,1,4)]

            assert refs[0].filename == tmpfile
            assert refs[0].lineno == 1
        finally:
            os.remove(newtmpfile)
            deleteTmpTestFile()
Example #5
0
    def test_returnsOtherFilesInSameNonPackageDirectory(self):
        try:
            classsrc = trimLines("""
            def testFunction():
                print 'hello'
            """)
            src = trimLines("""
            from baz import testFunction
            """)
            writeTmpTestFile(src)
            newtmpfile = os.path.join(tmproot, "baz.py")
            writeFile(newtmpfile, classsrc)
            refs = [x for x in findReferences(newtmpfile, 1, 4)]

            assert refs[0].filename == tmpfile
            assert refs[0].lineno == 1
        finally:
            os.remove(newtmpfile)
            deleteTmpTestFile()
 def helper4(self, src, importedsrc, line, col):
     createPackageStructure(src,importedsrc)
     filename = pkgstructureFile1
     refs =  [x for x in findReferences(filename,line,col)
              if x.confidence == 100]
     return refs
 def helper(self,src,lineno,colno):
     writeTmpTestFile(src)
     refs =  [x for x in findReferences(tmpfile,lineno,colno)]
     return refs
Example #8
0
 def findReferences_helper(self, src, lineno, colno):
     writeTmpTestFile(src)
     refs = [x for x in findReferences(tmpfile, lineno, colno)]
     return refs