mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Better testing of classes.
This commit is contained in:
@@ -763,14 +763,16 @@ class Class(ClassOrFunc):
|
||||
children = arglist.children
|
||||
except AttributeError:
|
||||
if arglist is not None:
|
||||
yield arglist
|
||||
for node_to_execute in arglist.nodes_to_execute():
|
||||
yield node_to_execute
|
||||
else:
|
||||
for argument in children:
|
||||
if argument.type == 'argument':
|
||||
# metaclass= or list comprehension or */**
|
||||
raise NotImplementedError('Metaclasses not implemented')
|
||||
else:
|
||||
yield argument
|
||||
for node_to_execute in argument.nodes_to_execute():
|
||||
yield node_to_execute
|
||||
|
||||
# care for the class suite:
|
||||
for node in self.children[self.children.index(':'):]:
|
||||
|
||||
13
test/static_analysis/class_simple.py
Normal file
13
test/static_analysis/class_simple.py
Normal file
@@ -0,0 +1,13 @@
|
||||
class Base(object):
|
||||
class Nested():
|
||||
def foo():
|
||||
pass
|
||||
|
||||
|
||||
class X(Base.Nested):
|
||||
pass
|
||||
|
||||
|
||||
X().foo()
|
||||
#! 4 attribute-error
|
||||
X().bar()
|
||||
Reference in New Issue
Block a user