summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcpopa <devnull@localhost>2013-08-14 14:49:16 +0300
committercpopa <devnull@localhost>2013-08-14 14:49:16 +0300
commitd6f0f08d500d7926643066393bbef5e455b0df86 (patch)
tree86b89edcb85ef1dd3e5812c0f078381f2d65284d
parent600183bf96f069aacf28295a87bd1660893006b7 (diff)
downloadastroid-d6f0f08d500d7926643066393bbef5e455b0df86.tar.gz
Add tests for the metaclass and newstyle discovery.
-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 bf3785c..eb37c2e 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')