mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Fix an about dict completions
This commit is contained in:
@@ -288,6 +288,8 @@ def cut_value_at_position(leaf, position):
|
|||||||
column = position[1]
|
column = position[1]
|
||||||
if leaf.line == position[0]:
|
if leaf.line == position[0]:
|
||||||
column -= leaf.column
|
column -= leaf.column
|
||||||
|
if not lines:
|
||||||
|
return ''
|
||||||
lines[-1] = lines[-1][:column]
|
lines[-1] = lines[-1][:column]
|
||||||
return ''.join(lines)
|
return ''.join(lines)
|
||||||
|
|
||||||
|
|||||||
@@ -394,8 +394,7 @@ def test_dict_keys_completions(Script, added_code, column, expected, skip_pre_py
|
|||||||
casted_mod["full"] = 8
|
casted_mod["full"] = 8
|
||||||
keywords = {None: 1, False: 2, "a": 3}
|
keywords = {None: 1, False: 2, "a": 3}
|
||||||
''')
|
''')
|
||||||
line = None
|
comps = Script(code + added_code).complete(column=column)
|
||||||
comps = Script(code + added_code).complete(line=line, column=column)
|
|
||||||
if Ellipsis in expected:
|
if Ellipsis in expected:
|
||||||
# This means that global completions are part of this, so filter all of
|
# This means that global completions are part of this, so filter all of
|
||||||
# that out.
|
# that out.
|
||||||
@@ -405,6 +404,11 @@ def test_dict_keys_completions(Script, added_code, column, expected, skip_pre_py
|
|||||||
assert [c.complete for c in comps] == expected
|
assert [c.complete for c in comps] == expected
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Ignore Python 2, because EOL")
|
||||||
|
def test_dict_keys_in_weird_case(Script, skip_pre_python36):
|
||||||
|
assert Script('a[\n# foo\nx]').complete(line=2, column=0)
|
||||||
|
|
||||||
|
|
||||||
def test_start_match():
|
def test_start_match():
|
||||||
assert _start_match('Condition', 'C')
|
assert _start_match('Condition', 'C')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user