forked from VimPlug/jedi
Merge branch 'master' into typeshed
This commit is contained in:
@@ -102,7 +102,7 @@ def test_function_call_signature_in_doc(Script):
|
||||
|
||||
|
||||
def test_param_docstring():
|
||||
param = jedi.names("def test(parameter): pass")[1]
|
||||
param = jedi.names("def test(parameter): pass", all_scopes=True)[1]
|
||||
assert param.name == 'parameter'
|
||||
assert param.docstring() == ''
|
||||
|
||||
|
||||
@@ -96,3 +96,25 @@ def test_names_twice(environment):
|
||||
|
||||
defs = names(source=source, environment=environment)
|
||||
assert defs[0].defined_names() == []
|
||||
|
||||
|
||||
def test_simple_name(environment):
|
||||
defs = names('foo', references=True, environment=environment)
|
||||
assert not defs[0]._name.infer()
|
||||
|
||||
|
||||
def test_no_error(environment):
|
||||
code = dedent("""
|
||||
def foo(a, b):
|
||||
if a == 10:
|
||||
if b is None:
|
||||
print("foo")
|
||||
a = 20
|
||||
""")
|
||||
func_name, = names(code)
|
||||
print(func_name.defined_names())
|
||||
a, b, a20 = func_name.defined_names()
|
||||
assert a.name == 'a'
|
||||
assert b.name == 'b'
|
||||
assert a20.name == 'a'
|
||||
assert a20.goto_assignments() == [a20]
|
||||
|
||||
@@ -131,6 +131,17 @@ def test_get_default_environment_from_env_does_not_use_safe(tmpdir, monkeypatch)
|
||||
assert env.path == 'fake'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('virtualenv', ['', 'fufuuuuu', sys.prefix])
|
||||
def test_get_default_environment_when_embedded(monkeypatch, virtualenv):
|
||||
# When using Python embedded, sometimes the executable is not a Python
|
||||
# executable.
|
||||
executable_name = 'RANDOM_EXE'
|
||||
monkeypatch.setattr(sys, 'executable', executable_name)
|
||||
monkeypatch.setenv('VIRTUAL_ENV', virtualenv)
|
||||
env = get_default_environment()
|
||||
assert env.executable != executable_name
|
||||
|
||||
|
||||
def test_changing_venv(venv_path, monkeypatch):
|
||||
monkeypatch.setitem(os.environ, 'VIRTUAL_ENV', venv_path)
|
||||
get_cached_default_environment()
|
||||
|
||||
Reference in New Issue
Block a user