summaryrefslogtreecommitdiff
path: root/tests/unittest_nodes.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2020-03-10 11:31:19 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2020-03-10 11:31:19 +0100
commitff0a72484b2560682aced148b04aebb12d6d369d (patch)
tree435221687882cfb10356338c7d9abd81b8e8c083 /tests/unittest_nodes.py
parent3de18c673972e238f600be3e56401df73717ecd8 (diff)
downloadastroid-git-ff0a72484b2560682aced148b04aebb12d6d369d.tar.gz
Change test that expected as_string() to return a particular number of newlines
Diffstat (limited to 'tests/unittest_nodes.py')
-rw-r--r--tests/unittest_nodes.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/unittest_nodes.py b/tests/unittest_nodes.py
index 2a8803a5..d7345f9f 100644
--- a/tests/unittest_nodes.py
+++ b/tests/unittest_nodes.py
@@ -148,21 +148,20 @@ def function(var):
ast = abuilder.string_build(code)
self.assertEqual(ast.as_string(), code)
- @test_utils.require_version("3.0")
- @unittest.expectedFailure
def test_3k_annotations_and_metaclass(self):
- code_annotations = textwrap.dedent(
- '''
- def function(var:int):
+ code = '''
+ def function(var: int):
nonlocal counter
class Language(metaclass=Natural):
"""natural language"""
'''
- )
+ code_annotations = textwrap.dedent(code)
+ # pylint: disable=line-too-long
+ expected = 'def function(var: int):\n nonlocal counter\n\n\nclass Language(metaclass=Natural):\n """natural language"""'
ast = abuilder.string_build(code_annotations)
- self.assertEqual(ast.as_string(), code_annotations)
+ self.assertEqual(ast.as_string().strip(), expected)
def test_ellipsis(self):
ast = abuilder.string_build("a[...]").body[0]