summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2013-08-14 14:49:16 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2013-08-14 14:49:16 +0300
commitadbeee2e2b84758d9dfd065f4c5d9810d1594950 (patch)
tree4b3f4213ba8e0836475911027ededee213a7cd85
parentcc301b2e96da6916a482e583183e32b8f5894c77 (diff)
downloadastroid-git-adbeee2e2b84758d9dfd065f4c5d9810d1594950.tar.gz
Add tests for the metaclass and newstyle discovery.
--HG-- branch : metaclass
-rw-r--r--test/unittest_scoped_nodes.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/unittest_scoped_nodes.py b/test/unittest_scoped_nodes.py
index bf3785c1..eb37c2e0 100644
--- a/test/unittest_scoped_nodes.py
+++ b/test/unittest_scoped_nodes.py
@@ -695,6 +695,24 @@ def g2():
self.assertIsInstance(metaclass, scoped_nodes.Class)
self.assertEqual(metaclass.name, 'ABCMeta')
+ @require_version('2.7')
+ def test_newstyle_and_metaclass_good(self):
+ astroid = abuilder.string_build(dedent("""
+ from abc import ABCMeta
+ class Test:
+ __metaclass__ = ABCMeta
+ """))
+ klass = astroid.body[1]
+ self.assertTrue(klass.newstyle)
+
+ def test_newstyle_and_metaclass_bad(self):
+ astroid = abuilder.string_build(dedent("""
+ class Test:
+ __metaclass__ = int
+ """))
+ klass = astroid.body[1]
+ self.assertFalse(klass.newstyle)
+
__all__ = ('ModuleNodeTC', 'ImportNodeTC', 'FunctionNodeTC', 'ClassNodeTC')