forked from VimPlug/jedi
Get a lot of tests passing
This commit is contained in:
@@ -4,6 +4,7 @@ Module for statical analysis.
|
||||
from jedi import debug
|
||||
from parso.python import tree
|
||||
from jedi.evaluate.compiled import CompiledObject
|
||||
from jedi.evaluate.helpers import is_string
|
||||
|
||||
|
||||
CODES = {
|
||||
@@ -117,6 +118,7 @@ def add_attribute_error(name_context, lookup_context, name):
|
||||
slot_names = lookup_context.get_function_slot_names('__getattr__') + \
|
||||
lookup_context.get_function_slot_names('__getattribute__')
|
||||
for n in slot_names:
|
||||
# TODO do we even get here?
|
||||
if isinstance(name, CompiledInstanceName) and \
|
||||
n.parent_context.obj == object:
|
||||
typ = Warning
|
||||
@@ -139,7 +141,7 @@ def _check_for_exception_catch(node_context, jedi_name, exception, payload=None)
|
||||
"""
|
||||
def check_match(cls, exception):
|
||||
try:
|
||||
return isinstance(cls, CompiledObject) and issubclass(exception, cls.obj)
|
||||
return isinstance(cls, CompiledObject) and cls.is_super_class(exception)
|
||||
except TypeError:
|
||||
return False
|
||||
|
||||
@@ -189,8 +191,8 @@ def _check_for_exception_catch(node_context, jedi_name, exception, payload=None)
|
||||
# Check name
|
||||
key, lazy_context = args[1]
|
||||
names = list(lazy_context.infer())
|
||||
assert len(names) == 1 and isinstance(names[0], CompiledObject)
|
||||
assert names[0].obj == payload[1].value
|
||||
assert len(names) == 1 and is_string(names[0])
|
||||
assert names[0].get_safe_value() == payload[1].value
|
||||
|
||||
# Check objects
|
||||
key, lazy_context = args[0]
|
||||
|
||||
Reference in New Issue
Block a user