1
0
forked from VimPlug/jedi

fix tests. Operators should not equal to other operators with a different position. or even parent.

This commit is contained in:
Dave Halter
2014-08-18 13:12:39 +02:00
parent 1d812c2414
commit 9f38f10366
3 changed files with 10 additions and 4 deletions

View File

@@ -451,7 +451,7 @@ def get_names_of_scope(evaluator, scope, position=None, star_search=True, includ
After that we have a few underscore names that have been defined After that we have a few underscore names that have been defined
>>> pairs[2] >>> pairs[2]
(<ModuleWrapper: <SubModule: None@1-5>>, [<FakeName: __file__@0,0>, ...]) (<ModuleWrapper: <SubModule: None@1-5>>, [<LazyName: __file__@0,0>, ...])
Finally, it yields names from builtin, if `include_builtin` is Finally, it yields names from builtin, if `include_builtin` is

View File

@@ -11,7 +11,6 @@ def fast_parent_copy(obj):
""" """
new_elements = {} new_elements = {}
accept = (pr.Simple, pr.NamePart) accept = (pr.Simple, pr.NamePart)
start=obj
def recursion(obj): def recursion(obj):
if isinstance(obj, pr.Statement): if isinstance(obj, pr.Statement):
@@ -93,6 +92,7 @@ def call_signature_array_for_pos(stmt, pos):
if new_arr is not None: if new_arr is not None:
return new_arr, index return new_arr, index
# TODO couldn't we merge with the len(arr) == 0 check?
if arr.start_pos < pos <= stmt.end_pos: if arr.start_pos < pos <= stmt.end_pos:
if arr.type in accepted_types and isinstance(arr.parent, pr.Call): if arr.type in accepted_types and isinstance(arr.parent, pr.Call):
return arr, i return arr, i

View File

@@ -1587,8 +1587,14 @@ class Operator(Simple):
return self.get_code() return self.get_code()
def __eq__(self, other): def __eq__(self, other):
"""Make comparisons easy. Improves the readability of the parser.""" """
return self.string == other Make comparisons with strings easy.
Improves the readability of the parser.
"""
if isinstance(other, Operator):
return self is other
else:
return self.string == other
def __ne__(self, other): def __ne__(self, other):
"""Python 2 compatibility.""" """Python 2 compatibility."""