mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 15:24:46 +08:00
create a more specific test for #396, which is again a fast parser issue
This commit is contained in:
@@ -231,9 +231,8 @@ def test_completion_interference():
|
|||||||
"""Seems to cause problems, see also #396."""
|
"""Seems to cause problems, see also #396."""
|
||||||
cache.parser_cache.pop(None, None)
|
cache.parser_cache.pop(None, None)
|
||||||
assert Script('open(').call_signatures()
|
assert Script('open(').call_signatures()
|
||||||
assert Script('open(').call_signatures()
|
|
||||||
|
|
||||||
# complete something usual, before doing the same call_signatures again.
|
# complete something usual, before doing the same call_signatures again.
|
||||||
assert Script('from os import ').completions()
|
assert Script('from datetime import ').completions()
|
||||||
|
|
||||||
assert Script('open(').call_signatures()
|
assert Script('open(').call_signatures()
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from textwrap import dedent
|
|||||||
|
|
||||||
import jedi
|
import jedi
|
||||||
from jedi._compatibility import u
|
from jedi._compatibility import u
|
||||||
|
from jedi import cache
|
||||||
from jedi.parser.fast import FastParser
|
from jedi.parser.fast import FastParser
|
||||||
|
|
||||||
|
|
||||||
@@ -55,3 +56,21 @@ def test_carriage_return_splitting():
|
|||||||
source = source.replace('\n', '\r\n')
|
source = source.replace('\n', '\r\n')
|
||||||
p = FastParser(source)
|
p = FastParser(source)
|
||||||
assert [str(n) for n in p.module.get_defined_names()] == ['Foo']
|
assert [str(n) for n in p.module.get_defined_names()] == ['Foo']
|
||||||
|
|
||||||
|
|
||||||
|
def test_change_and_undo():
|
||||||
|
cache.parser_cache.pop(None, None)
|
||||||
|
|
||||||
|
def fp(src):
|
||||||
|
p = FastParser(u(src))
|
||||||
|
cache.save_parser(None, None, p, pickling=False)
|
||||||
|
|
||||||
|
# TODO Don't just take the first line, the whole thing should be the same.
|
||||||
|
# Need to refactor the parser first, though.
|
||||||
|
print(repr(p.module.get_code()))
|
||||||
|
first_line = p.module.get_code().splitlines()[0]
|
||||||
|
assert first_line == src
|
||||||
|
|
||||||
|
fp('a')
|
||||||
|
fp('b')
|
||||||
|
fp('a')
|
||||||
|
|||||||
Reference in New Issue
Block a user