mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
pep8
This commit is contained in:
@@ -642,7 +642,7 @@ class Statement(Simple):
|
|||||||
if close_brackets:
|
if close_brackets:
|
||||||
result = result.parent
|
result = result.parent
|
||||||
close_brackets = False
|
close_brackets = False
|
||||||
if result.__class__ == Call:
|
if result.__class__ == Call:
|
||||||
result = result.parent
|
result = result.parent
|
||||||
close_brackets = False
|
close_brackets = False
|
||||||
call = Call(tok, c_type, parent=result)
|
call = Call(tok, c_type, parent=result)
|
||||||
|
|||||||
24
test/run.py
24
test/run.py
@@ -17,6 +17,7 @@ if only_line is not None:
|
|||||||
debug.ignored_modules = ['parsing', 'builtin']
|
debug.ignored_modules = ['parsing', 'builtin']
|
||||||
#functions.set_debug_function(functions.debug.print_to_stdout)
|
#functions.set_debug_function(functions.debug.print_to_stdout)
|
||||||
|
|
||||||
|
|
||||||
def run_completion_test(correct, source, line_nr, line):
|
def run_completion_test(correct, source, line_nr, line):
|
||||||
"""
|
"""
|
||||||
Runs tests for completions.
|
Runs tests for completions.
|
||||||
@@ -28,7 +29,7 @@ def run_completion_test(correct, source, line_nr, line):
|
|||||||
completions = functions.complete(source, line_nr, 999,
|
completions = functions.complete(source, line_nr, 999,
|
||||||
completion_test_dir)
|
completion_test_dir)
|
||||||
except (Exception, functions.evaluate.MultiLevelAttributeError):
|
except (Exception, functions.evaluate.MultiLevelAttributeError):
|
||||||
print('test @%s: %s' % (line_nr-1, line))
|
print('test @%s: %s' % (line_nr - 1, line))
|
||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
@@ -52,7 +53,7 @@ def run_definition_test(correct, source, line_nr, line, correct_start):
|
|||||||
try:
|
try:
|
||||||
result = defs(line_nr, 999)
|
result = defs(line_nr, 999)
|
||||||
except (Exception, functions.evaluate.MultiLevelAttributeError):
|
except (Exception, functions.evaluate.MultiLevelAttributeError):
|
||||||
print('test @%s: %s' % (line_nr-1, line))
|
print('test @%s: %s' % (line_nr - 1, line))
|
||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
@@ -63,7 +64,7 @@ def run_definition_test(correct, source, line_nr, line, correct_start):
|
|||||||
# -1 for the comment, +3 because of the comment start `#? `
|
# -1 for the comment, +3 because of the comment start `#? `
|
||||||
start = index.start() + 3
|
start = index.start() + 3
|
||||||
try:
|
try:
|
||||||
should_be |= defs(line_nr-1, start+correct_start)
|
should_be |= defs(line_nr - 1, start + correct_start)
|
||||||
except Exception:
|
except Exception:
|
||||||
print('could not resolve %s indent %s' % (line_nr - 1, start))
|
print('could not resolve %s indent %s' % (line_nr - 1, start))
|
||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
@@ -77,6 +78,7 @@ def run_definition_test(correct, source, line_nr, line, correct_start):
|
|||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def run_test(source):
|
def run_test(source):
|
||||||
"""
|
"""
|
||||||
This is the completion test for some cases. The tests are not unit test
|
This is the completion test for some cases. The tests are not unit test
|
||||||
@@ -118,10 +120,7 @@ def run_test(source):
|
|||||||
correct = None
|
correct = None
|
||||||
return tests, fails
|
return tests, fails
|
||||||
|
|
||||||
# completion tests:
|
|
||||||
completion_test_dir = 'test/completion'
|
|
||||||
summary = []
|
|
||||||
tests_pass = True
|
|
||||||
def test_dir(completion_test_dir, third_party=False):
|
def test_dir(completion_test_dir, third_party=False):
|
||||||
global tests_pass
|
global tests_pass
|
||||||
for f_name in os.listdir(completion_test_dir):
|
for f_name in os.listdir(completion_test_dir):
|
||||||
@@ -134,17 +133,24 @@ def test_dir(completion_test_dir, third_party=False):
|
|||||||
try:
|
try:
|
||||||
__import__(f_name.replace('.py', ''))
|
__import__(f_name.replace('.py', ''))
|
||||||
except ImportError:
|
except ImportError:
|
||||||
summary.append('Thirdparty-Library %s not found.' % f_name)
|
summary.append('Thirdparty-Library %s not found.' %
|
||||||
|
f_name)
|
||||||
continue
|
continue
|
||||||
path = os.path.join(completion_test_dir, f_name)
|
path = os.path.join(completion_test_dir, f_name)
|
||||||
f = open(path)
|
f = open(path)
|
||||||
num_tests, fails = run_test(f.read())
|
num_tests, fails = run_test(f.read())
|
||||||
s = 'run %s tests with %s fails (%s)' % (num_tests, fails, f_name)
|
s = 'run %s tests with %s fails (%s)' % (num_tests, fails,
|
||||||
|
f_name)
|
||||||
if fails:
|
if fails:
|
||||||
tests_pass = False
|
tests_pass = False
|
||||||
print(s)
|
print(s)
|
||||||
summary.append(s)
|
summary.append(s)
|
||||||
|
|
||||||
|
# completion tests:
|
||||||
|
completion_test_dir = 'test/completion'
|
||||||
|
summary = []
|
||||||
|
tests_pass = True
|
||||||
|
|
||||||
test_dir(completion_test_dir)
|
test_dir(completion_test_dir)
|
||||||
test_dir(completion_test_dir + '/thirdparty', third_party=True)
|
test_dir(completion_test_dir + '/thirdparty', third_party=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user