diff options
author | Emile Anclin <emile.anclin@logilab.fr> | 2010-11-02 11:10:16 +0100 |
---|---|---|
committer | Emile Anclin <emile.anclin@logilab.fr> | 2010-11-02 11:10:16 +0100 |
commit | c55753fb8782d36d81a3ee36646b22061d2c6d21 (patch) | |
tree | cae94cdce161ffdb887621f3789b80f9c5f371aa | |
parent | 15e9c4e353f7bb7c4d1df6b4aaefa0d6156e4943 (diff) | |
download | astroid-git-c55753fb8782d36d81a3ee36646b22061d2c6d21.tar.gz |
py3k: test new as_string methods
-rw-r--r-- | test/unittest_nodes.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/unittest_nodes.py b/test/unittest_nodes.py index d56a092c..40401243 100644 --- a/test/unittest_nodes.py +++ b/test/unittest_nodes.py @@ -244,6 +244,31 @@ cdd = {k for k in b}\n\n''' ast = abuilder.string_build(code) self.assertMultiLineEqual(as_string(ast), code) + def test_3k_as_string(self): + """check as_string for python 3k syntax""" + if sys.version_info < (3, 0): + self.skipTest("test python 3k specific") + code = '''print() + +def function(var): + nonlocal counter + try: + hello + except NameError as nexc: + (*hell, o) = b'hello' + raise AttributeError from nexc +\n''' + # TODO : annotations and keywords for class definition are not yet implemented + _todo = ''' +def function(var:int): + nonlocal counter + +class Language(metaclass=Natural): + """natural language""" + ''' + ast = abuilder.string_build(code) + self.assertEqual(as_string(ast), code) + class CmpNodeTC(testlib.TestCase): def test_as_string(self): |