refactor icon indicating copy to clipboard operation
refactor copied to clipboard

(fix) Proposing to collect empty separation lines with comments

Open MementoRC opened this issue 3 years ago • 2 comments

This is not fully tested, in particular the added test fails because the :

    expected_src = textwrap.dedent(
        """\
    def foo():
        # indented but not connected comment
        

cannot hold a line of spaces, but the modification automatically produces them, so the test fails with no possibility to make it pass (maybe this is a dedent peculiarity?)

MementoRC avatar Dec 05 '22 18:12 MementoRC

To pass the test, the proposed Unparser need to not use textwrap.dedent in the INPUT/EXPECTED strings to not remove the indented spaces on the empty lines that are set when an empty line is found (whether with or without spaces).

MementoRC avatar Dec 06 '22 15:12 MementoRC

The issue was due to collecting empty lines after the node to replace and somehow double counting them in some cases. Restoring the original test.

It would be good to look more closely, the new unparser created duplicated newlines in the insert_after test at the Replace statement, it added an extra newline and made the test fail with the newline appearing at the end of the 3 try/except blocks.

MementoRC avatar Dec 10 '22 17:12 MementoRC