Better testing of classes.

This commit is contained in:
Dave Halter
2015-12-12 02:48:37 +01:00
parent 75ac2b9686
commit 28585dcdba
2 changed files with 17 additions and 2 deletions

View File

@@ -763,14 +763,16 @@ class Class(ClassOrFunc):
children = arglist.children children = arglist.children
except AttributeError: except AttributeError:
if arglist is not None: if arglist is not None:
yield arglist for node_to_execute in arglist.nodes_to_execute():
yield node_to_execute
else: else:
for argument in children: for argument in children:
if argument.type == 'argument': if argument.type == 'argument':
# metaclass= or list comprehension or */** # metaclass= or list comprehension or */**
raise NotImplementedError('Metaclasses not implemented') raise NotImplementedError('Metaclasses not implemented')
else: else:
yield argument for node_to_execute in argument.nodes_to_execute():
yield node_to_execute
# care for the class suite: # care for the class suite:
for node in self.children[self.children.index(':'):]: for node in self.children[self.children.index(':'):]:

View 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()