call_signatures caching should be much more precise, now. fixes #390

This commit is contained in:
Dave Halter
2014-04-09 12:26:37 +02:00
parent d2dc39e0c2
commit 46277eb9c9
3 changed files with 36 additions and 4 deletions

View File

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