Corrected formatting

This commit is contained in:
Johannes Maria Frank
2019-10-21 15:44:03 +01:00
parent d73f32745d
commit 2653752f9c

View File

@@ -23,7 +23,8 @@ def test_preload_modules():
# Filter the typeshed parser cache. # Filter the typeshed parser cache.
typeshed_cache_count = sum( typeshed_cache_count = sum(
1 for path in grammar_cache 1 for path in grammar_cache
if path is not None and path.startswith(typeshed.TYPESHED_PATH)) if path is not None and path.startswith(typeshed.TYPESHED_PATH)
)
# +1 for None module (currently used) # +1 for None module (currently used)
assert len(grammar_cache) - typeshed_cache_count == len(modules) + 1 assert len(grammar_cache) - typeshed_cache_count == len(modules) + 1
for i in modules: for i in modules:
@@ -34,8 +35,7 @@ def test_preload_modules():
try: try:
preload_module('sys') preload_module('sys')
check_loaded( check_loaded() # compiled (c_builtin) modules shouldn't be in the cache.
) # compiled (c_builtin) modules shouldn't be in the cache.
preload_module('types', 'token') preload_module('types', 'token')
check_loaded('types', 'token') check_loaded('types', 'token')
finally: finally:
@@ -117,9 +117,8 @@ def test_completion_on_complex_literals(Script):
# However this has been disabled again, because it apparently annoyed # However this has been disabled again, because it apparently annoyed
# users. So no completion after j without a space :) # users. So no completion after j without a space :)
assert not Script('4j').completions() assert not Script('4j').completions()
assert ({c.name assert ({c.name for c in Script('4j ').completions()} ==
for c in Script('4j ').completions() {'if', 'and', 'in', 'is', 'not', 'or'})
} == {'if', 'and', 'in', 'is', 'not', 'or'})
def test_goto_assignments_on_non_name(Script, environment): def test_goto_assignments_on_non_name(Script, environment):
@@ -168,8 +167,7 @@ def test_usage_description(Script):
def test_get_line_code(Script): def test_get_line_code(Script):
def get_line_code(source, line=None, **kwargs): def get_line_code(source, line=None, **kwargs):
return Script(source, return Script(source, line=line).completions()[0].get_line_code(**kwargs)
line=line).completions()[0].get_line_code(**kwargs)
# On builtin # On builtin
assert get_line_code('') == '' assert get_line_code('') == ''
@@ -246,7 +244,8 @@ def test_goto_definition_cursor(Script):
" b):\n" " b):\n"
" return\n" " return\n"
"A._something\n" "A._something\n"
"A.different_line") "A.different_line"
)
in_name = 2, 9 in_name = 2, 9
under_score = 2, 8 under_score = 2, 8
@@ -307,7 +306,7 @@ def test_goto_follow_builtin_imports(Script):
assert d.in_builtin_module() is True assert d.in_builtin_module() is True
def test_str_fuzzy_completion(Script): def test_fuzzy_completion(Script):
script = Script('string = "hello"\nstring.upper') script = Script('string = "hello"\nstring.upper')
assert ['isupper', assert ['isupper',
'upper'] == [comp.name for comp in script.completions(fuzzy=True)] 'upper'] == [comp.name for comp in script.completions(fuzzy=True)]
@@ -326,4 +325,4 @@ def test_math_fuzzy_completion(Script):
def test_math_fuzzy_completion(Script): def test_math_fuzzy_completion(Script):
script = Script('import math\nmath.og') script = Script('import math\nmath.og')
assert ['copysign', 'log', 'log10', assert ['copysign', 'log', 'log10',
'log1p'] == [comp.name for comp in script.completions(fuzzy=True)] 'log1p'] == [comp.name for comp in script.completions(fuzzy=True)]