diff options
| author | Sylvain Thénault <thenault@gmail.com> | 2014-04-17 17:28:23 +0200 |
|---|---|---|
| committer | Sylvain Thénault <thenault@gmail.com> | 2014-04-17 17:28:23 +0200 |
| commit | 5d39c45124f91b5dc4aff6236dea4acba666199e (patch) | |
| tree | c13d3e0d0d9c58189bb1738315d1e2b8197394ac /test | |
| parent | 2195d72ae7a41d740d26c652e46bc7f1f70a245f (diff) | |
| parent | c26264de06f038b7fd41f54ecfbaef4694755814 (diff) | |
| download | astroid-git-5d39c45124f91b5dc4aff6236dea4acba666199e.tar.gz | |
Merged in PCManticore/astroid/ancestors (pull request #29)
Unwrap instances found in `.ancestors()`, by using their _proxied class. Don't inherit the metaclass status if the current class can't be a metaclass.
Diffstat (limited to 'test')
| -rw-r--r-- | test/data/module2.py | 8 | ||||
| -rw-r--r-- | test/unittest_scoped_nodes.py | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/test/data/module2.py b/test/data/module2.py index f317855b..d6bf49eb 100644 --- a/test/data/module2.py +++ b/test/data/module2.py @@ -133,3 +133,11 @@ def not_a_generator(): yield genl = lambda : (yield) +def with_metaclass(meta, *bases): + return meta('NewBase', bases, {}) + + +class NotMetaclass(with_metaclass(Metaclass)): + pass + + diff --git a/test/unittest_scoped_nodes.py b/test/unittest_scoped_nodes.py index 0489b209..754db1e2 100644 --- a/test/unittest_scoped_nodes.py +++ b/test/unittest_scoped_nodes.py @@ -509,6 +509,11 @@ A.__bases__ += (B,) self.assertEqual(klass.type, 'interface') klass = MODULE2['MyError'] self.assertEqual(klass.type, 'exception') + # the following class used to be detected as a metaclass + # after the fix which used instance._proxied in .ancestors(), + # when in fact it is a normal class + klass = MODULE2['NotMetaclass'] + self.assertEqual(klass.type, 'class') def test_interfaces(self): for klass, interfaces in (('Concrete0', ['MyIFace']), |
