def test_notAs(self): color.blue("test here baby") filename1 = os.path.join(currentFolder, '../testPoligon/py/a.py') obj = 'b_model' result = pyFind.filename2(filename1, obj) expected = os.path.join(currentFolder, '../testPoligon/py/b_model.py') self.assertEqual(result, expected)
def filenameAndPositionTransform(filename, position): ext = filename.split('.')[-1] isPy = ext == 'py' text = filer.read(filename) filename2 = filename position2 = 0 color.red('text') print(text) color.red('position') print(repr(position)) [obj, method] = getObject(text, position) color.red('obj') print(repr(obj)) color.red('method') print(repr(method)) if isPy: filename2 = pyFind.filename2(filename, obj) color.red('filename2') print(repr(filename2)) if method: regex = "def {0}\(|{0} =".format(method) color.red('regex') print(repr(regex)) position2 = getPosition(filename2, regex) if position2 > 0: position2 = position2 + len("def") else: if obj: color.red('text') print(text) color.red('obj') print(repr(obj)) rel = findRequire(text, obj) color.red('rel') print(repr(rel)) filename2 = absRel.AbsAddExtension(filename, rel) regex = method + ' = ' position2 = getPosition(filename2, regex) return (filename2, position2)
def test_testName(self): color.blue("test here baby") filename = os.path.join(currentFolder, '../testPoligon/local.py') result = pyFind.filename2(filename, 'y') expected = filename assertMy.equals(result, expected)