mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 07:14:48 +08:00
call_signatures caching should be much more precise, now. fixes #390
This commit is contained in:
@@ -65,7 +65,7 @@ def test_modulepickling_delete_incompatible_cache():
|
||||
def test_star_import_cache_duration():
|
||||
new = 0.01
|
||||
old, jedi.settings.star_import_cache_validity = \
|
||||
jedi.settings.star_import_cache_validity, new
|
||||
jedi.settings.star_import_cache_validity, new
|
||||
|
||||
cache._star_import_cache = {} # first empty...
|
||||
# path needs to be not-None (otherwise caching effects are not visible)
|
||||
@@ -78,3 +78,24 @@ def test_star_import_cache_duration():
|
||||
length = len(cache._star_import_cache)
|
||||
cache._star_import_cache = {}
|
||||
assert length == 1
|
||||
|
||||
|
||||
def test_cache_call_signatures():
|
||||
"""
|
||||
See github issue #390.
|
||||
"""
|
||||
def check(column, call_name, path=None):
|
||||
assert jedi.Script(s, 1, column, path).call_signatures()[0].name == call_name
|
||||
|
||||
s = 'str(int())'
|
||||
|
||||
for i in range(3):
|
||||
check(8, 'int')
|
||||
check(4, 'str')
|
||||
# Can keep doing these calls and always get the right result.
|
||||
|
||||
# Now lets specify a source_path of boo and alternate these calls, it
|
||||
# should still work.
|
||||
for i in range(3):
|
||||
check(8, 'int', 'boo')
|
||||
check(4, 'str', 'boo')
|
||||
|
||||
Reference in New Issue
Block a user