mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-23 04:12:05 +08:00
Correct issues with slices and some more subtle bugs.
This commit is contained in:
@@ -316,7 +316,7 @@ class TestGotoAssignments(TestCase):
|
||||
n = nms[1].goto_assignments()[0]
|
||||
# This is very special, normally the name doesn't chance, but since
|
||||
# os.path is a sys.modules hack, it does.
|
||||
assert n.name in ('ntpath', 'posixpath')
|
||||
assert n.name in ('ntpath', 'posixpath', 'os2emxpath')
|
||||
assert n.type == 'module'
|
||||
|
||||
def test_import_alias(self):
|
||||
|
||||
@@ -9,14 +9,14 @@ def test_paths_from_assignment():
|
||||
def paths(src):
|
||||
grammar = load_grammar()
|
||||
stmt = Parser(grammar, unicode(src)).module.statements[0]
|
||||
return list(sys_path._paths_from_assignment(Evaluator(grammar), stmt))
|
||||
return set(sys_path._paths_from_assignment(Evaluator(grammar), stmt))
|
||||
|
||||
assert paths('sys.path[0:0] = ["a"]') == ['a']
|
||||
assert paths('sys.path = ["b", 1, x + 3, y, "c"]') == ['b', 'c']
|
||||
assert paths('sys.path = a = ["a"]') == ['a']
|
||||
assert paths('sys.path[0:0] = ["a"]') == set(['a'])
|
||||
assert paths('sys.path = ["b", 1, x + 3, y, "c"]') == set(['b', 'c'])
|
||||
assert paths('sys.path = a = ["a"]') == set(['a'])
|
||||
|
||||
# Fail for complicated examples.
|
||||
assert paths('sys.path, other = ["a"], 2') == []
|
||||
assert paths('sys.path, other = ["a"], 2') == set()
|
||||
|
||||
|
||||
def test_get_sys_path(monkeypatch):
|
||||
|
||||
Reference in New Issue
Block a user