def test_find_definition(self): this_dir = os.path.split(__file__)[0] path = os.path.join(this_dir, 'projects', 'main', 'basic', 'bar.py') with open(path, 'r') as f: code = f.read() loc = findit.find_definition(self.proj, code, 142, os.path.join('basic', 'bar.py')) self.assertEqual( loc, (os.path.join('basic', 'bar.py'), (91, 100), 91, False, 7))
def test_find_definition(self): path = os.path.join( common.activated_path('main'), 'basic', 'bar.py') with open(path, 'r') as f: code = f.read() loc = findit.find_definition(self.proj, code, 142, os.path.join('basic', 'bar.py')) self.assertEqual( loc, (os.path.join('basic', 'bar.py'), (91, 100), 91, False, 7))
def findit_definitions_view(): from traad.rope.findit import find_definition args = request.json data = find_definition(project, args['code'], args['offset'], args['path']) # TODO: What if it actually fails? return { 'result': 'success', 'data': data, }