Whitespace different for methods with tuples at end
akov opened this issue · 1 comments
akov commented
In [25]: code = """\
class Foo():
def a(self):
return 1
def b(self):
return 2
def c(self):
return 3
"""
In [26]: tree = pasta.parse(code)
In [27]: tree.body[0].body.pop(1).name
Out[27]: 'b'
In [28]: print pasta.dump(tree)
class Foo():
def a(self):
return 1
def c(self):
return 3
In [29]: code = """\
class Foo():
def a(self):
return 1
def b(self):
return 2,'a'
def c(self):
return 3
"""
In [30]: tree = pasta.parse(code)
In [31]: tree.body[0].body.pop(1).name
Out[31]: 'b'
In [32]: print pasta.dump(tree)
class Foo():
def a(self):
return 1
def c(self):
return 3
The first snippet here acts as expected. I would expect the result of the second snippet to be the same, but in reality a newline seems to get lost.
soupytwist commented
It's fixed in master. This is a more general issue of parsing a suffix for child nodes. Now, the formatting data for space between elements of a tuple is stored on the tuple rather than on the children.