mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
sith now also uses the new API
This commit is contained in:
8
sith.py
8
sith.py
@@ -95,9 +95,7 @@ class TestCase(object):
|
|||||||
args = json.load(f)
|
args = json.load(f)
|
||||||
return cls(*args)
|
return cls(*args)
|
||||||
|
|
||||||
operations = [
|
operations = ['complete', 'goto', 'infer', 'find_references', 'find_signatures']
|
||||||
'completions', 'goto_assignments', 'goto_definitions', 'usages',
|
|
||||||
'call_signatures']
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def generate(cls, file_path):
|
def generate(cls, file_path):
|
||||||
@@ -123,12 +121,12 @@ class TestCase(object):
|
|||||||
def run(self, debugger, record=None, print_result=False):
|
def run(self, debugger, record=None, print_result=False):
|
||||||
try:
|
try:
|
||||||
with open(self.path) as f:
|
with open(self.path) as f:
|
||||||
self.script = jedi.Script(f.read(), self.line, self.column, self.path)
|
self.script = jedi.Script(f.read(), path=self.path)
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
if self.operation == 'goto_assignments':
|
if self.operation == 'goto_assignments':
|
||||||
kwargs['follow_imports'] = random.choice([False, True])
|
kwargs['follow_imports'] = random.choice([False, True])
|
||||||
|
|
||||||
self.objects = getattr(self.script, self.operation)(**kwargs)
|
self.objects = getattr(self.script, self.operation)(self.line, self.column, **kwargs)
|
||||||
if print_result:
|
if print_result:
|
||||||
print("{path}: Line {line} column {column}".format(**self.__dict__))
|
print("{path}: Line {line} column {column}".format(**self.__dict__))
|
||||||
self.show_location(self.line, self.column)
|
self.show_location(self.line, self.column)
|
||||||
|
|||||||
Reference in New Issue
Block a user