mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
Added test for math og
This commit is contained in:
@@ -23,8 +23,7 @@ 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:
|
||||||
@@ -35,7 +34,8 @@ def test_preload_modules():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
preload_module('sys')
|
preload_module('sys')
|
||||||
check_loaded() # compiled (c_builtin) modules shouldn't be in the cache.
|
check_loaded(
|
||||||
|
) # 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,8 +117,9 @@ 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 for c in Script('4j ').completions()} ==
|
assert ({c.name
|
||||||
{'if', 'and', 'in', 'is', 'not', 'or'})
|
for c in Script('4j ').completions()
|
||||||
|
} == {'if', 'and', 'in', 'is', 'not', 'or'})
|
||||||
|
|
||||||
|
|
||||||
def test_goto_assignments_on_non_name(Script, environment):
|
def test_goto_assignments_on_non_name(Script, environment):
|
||||||
@@ -167,7 +168,8 @@ 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, line=line).completions()[0].get_line_code(**kwargs)
|
return Script(source,
|
||||||
|
line=line).completions()[0].get_line_code(**kwargs)
|
||||||
|
|
||||||
# On builtin
|
# On builtin
|
||||||
assert get_line_code('') == ''
|
assert get_line_code('') == ''
|
||||||
@@ -244,8 +246,7 @@ 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
|
||||||
@@ -308,6 +309,8 @@ def test_goto_follow_builtin_imports(Script):
|
|||||||
|
|
||||||
def test_fuzzy_completion(Script):
|
def test_fuzzy_completion(Script):
|
||||||
script = Script('string = "hello"\nstring.upper')
|
script = Script('string = "hello"\nstring.upper')
|
||||||
assert ['isupper', 'upper'] == [comp.name
|
assert ['isupper',
|
||||||
for comp in
|
'upper'] == [comp.name for comp in script.completions(fuzzy=True)]
|
||||||
script.completions(fuzzy=True)]
|
script = Script('import math\nmath.og')
|
||||||
|
assert ['copysign', 'log', 'log10', 'log1p',
|
||||||
|
'log2'] == [comp.name for comp in script.completions(fuzzy=True)]
|
||||||
|
|||||||
Reference in New Issue
Block a user