Skip to content

Follow up to "Unrelated comment was deleted after a change #495" #506

@BonaFideIT

Description

@BonaFideIT

Python Version

3.11.10

Django Version

4.2.15

Package Version

1.22.1

Description

This is a follow up issue from #495.

As mentioned in pyupgrade in asottile/pyupgrade#931, the trailing comments problem is not fixable.

The following test case will fail pass:

def test_removed_block_internal_comment_2():
    check_transformed(
        """\
        import django

        if django.VERSION < (3, 2):
            foo()
            # test comment
        # test comment 2
        """,
        """\
        import django

        # test comment 2
        """,
    )

Should the changes from c219454 be reverted since it does not resolve all possible variants of the problem, @adamchainz what do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions