diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2013-08-14 14:31:26 +0300 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2013-08-14 14:31:26 +0300 |
commit | 2579966614a246ce3bb1bad67238f6a0b36f0ff6 (patch) | |
tree | ef7898261c02576e6c9fce0121b69c0495b8bfba | |
parent | f0662f4e8ac0f4cb3e1242a4beb6d3d4944f156c (diff) | |
download | astroid-git-2579966614a246ce3bb1bad67238f6a0b36f0ff6.tar.gz |
Add test for .as_string.
--HG--
branch : metaclass
-rw-r--r-- | test/unittest_python3.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unittest_python3.py b/test/unittest_python3.py index 761fbcff..0102c323 100644 --- a/test/unittest_python3.py +++ b/test/unittest_python3.py @@ -69,5 +69,17 @@ class Python3TC(TestCase): self.assertIsInstance(metaclass, Class) self.assertEqual(metaclass.name, 'ABCMeta') + @require_version('3.0') + def test_as_string(self): + body = dedent(""" + from abc import ABCMeta + class Test(metaclass=ABCMeta): pass""") + astroid = self.builder.string_build(body) + klass = astroid.body[1] + + self.assertEqual(klass.as_string(), + '\n\nclass Test(metaclass=ABCMeta):\n pass\n') + + if __name__ == '__main__': unittest_main() |