forked from VimPlug/jedi
Fixed more parser tests.
This commit is contained in:
@@ -39,7 +39,7 @@ def check_error_statements(evaluator, module, pos):
|
||||
if error_statement.first_type in ('import_from', 'import_name') \
|
||||
and error_statement.first_pos < pos <= error_statement.next_start_pos:
|
||||
return importer_from_error_statement(evaluator, module, error_statement, pos)
|
||||
return None
|
||||
return None, False
|
||||
|
||||
|
||||
def importer_from_error_statement(evaluator, module, error_statement, pos):
|
||||
|
||||
@@ -3,6 +3,7 @@ from textwrap import dedent
|
||||
import jedi
|
||||
from jedi._compatibility import u
|
||||
from jedi import cache
|
||||
from jedi.parser import load_grammar
|
||||
from jedi.parser.fast import FastParser
|
||||
|
||||
|
||||
@@ -54,14 +55,14 @@ def test_carriage_return_splitting():
|
||||
pass
|
||||
'''))
|
||||
source = source.replace('\n', '\r\n')
|
||||
p = FastParser(source)
|
||||
p = FastParser(load_grammar(), source)
|
||||
assert [str(n) for n in p.module.get_defined_names()] == ['Foo']
|
||||
|
||||
|
||||
def test_change_and_undo():
|
||||
|
||||
def fp(src):
|
||||
p = FastParser(u(src))
|
||||
p = FastParser(load_grammar(), u(src))
|
||||
cache.save_parser(None, None, p, pickling=False)
|
||||
|
||||
# TODO Don't change get_code, the whole thing should be the same.
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
from jedi.parser import Parser
|
||||
from jedi.parser import representation as pr
|
||||
from jedi._compatibility import u
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def test_import_is_nested():
|
||||
imp = Parser(u('import ')).module.imports[0]
|
||||
# should not raise an error, even if it's not a complete import
|
||||
assert not imp.is_nested()
|
||||
|
||||
|
||||
@pytest.mark.skipif('True', 'Reenable this later, module should also have a scope_names_generator.')
|
||||
def test_module_scope_name_generator():
|
||||
assert pr.Module().scope_names_generator()
|
||||
Reference in New Issue
Block a user