diff options
| author | Claudiu Popa <pcmanticore@gmail.com> | 2014-04-12 09:46:49 +0300 |
|---|---|---|
| committer | Claudiu Popa <pcmanticore@gmail.com> | 2014-04-12 09:46:49 +0300 |
| commit | bbb83b5b8356ef7432ed4741e171a483e88a49ee (patch) | |
| tree | 10fbd880bed4fb5d367086f66749bc0b7f7a8d5e /test | |
| parent | 9781343aa75f6425b4ea68ea9eb149770160dfba (diff) | |
| download | astroid-git-bbb83b5b8356ef7432ed4741e171a483e88a49ee.tar.gz | |
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.
--HG--
branch : ancestors
Diffstat (limited to 'test')
| -rw-r--r-- | test/data/module2.py | 8 | ||||
| -rw-r--r-- | test/unittest_scoped_nodes.py | 2 |
2 files changed, 10 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..486cd982 100644 --- a/test/unittest_scoped_nodes.py +++ b/test/unittest_scoped_nodes.py @@ -509,6 +509,8 @@ A.__bases__ += (B,) self.assertEqual(klass.type, 'interface') klass = MODULE2['MyError'] self.assertEqual(klass.type, 'exception') + klass = MODULE2['NotMetaclass'] + self.assertEqual(klass.type, 'class') def test_interfaces(self): for klass, interfaces in (('Concrete0', ['MyIFace']), |
