sith now also uses the new API

This commit is contained in:
Dave Halter
2019-12-20 19:45:20 +01:00
parent 5fc308f1f8
commit e5496381f3

View File

@@ -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)