mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
Make a test a bit better testable (more flexible).
This commit is contained in:
@@ -131,6 +131,7 @@ class Script(object):
|
||||
self._evaluator = Evaluator(self._grammar, sys_path=sys_path)
|
||||
debug.speed('init')
|
||||
|
||||
@cache.memoize_method
|
||||
def _get_module(self):
|
||||
cache.invalidate_star_import_cache(self._path)
|
||||
parser = FastParser(self._grammar, self._source, self.path)
|
||||
|
||||
@@ -31,12 +31,18 @@ def test_add_to_end():
|
||||
|
||||
b = " def h(self):\n" \
|
||||
" self."
|
||||
assert jedi.Script(a, 7, 12, 'example.py').completions()
|
||||
assert jedi.Script(a + b, path='example.py').completions()
|
||||
|
||||
def complete(code, line=None, column=None):
|
||||
script = jedi.Script(code, line, column, 'example.py')
|
||||
assert script.completions()
|
||||
_assert_valid_graph(script._get_module())
|
||||
|
||||
complete(a, 7, 12)
|
||||
complete(a + b)
|
||||
|
||||
a = a[:-1] + '.\n'
|
||||
assert jedi.Script(a, 7, 13, 'example.py').completions()
|
||||
assert jedi.Script(a + b, path='example.py').completions()
|
||||
complete(a, 7, 13)
|
||||
complete(a + b)
|
||||
|
||||
|
||||
def _check_error_leaves_nodes(node):
|
||||
|
||||
Reference in New Issue
Block a user