Skip to content

Invalid suggestion from Sourcery on set comprehension inside f-string #362

Open
@williamjamir

Description

@williamjamir

Checklist

  • I have searched the Sourcery documentation for the issue and found nothing
  • I have checked there are no open bugs referencing the same bug or problem

Description

That is an invalid suggestion from Sourcery.
image

Code snippet that reproduces issue

>>> test = [1, None, {}, 3]
>>> f"Test - {set(i for i in test)}"
"Test - {'NoneType', 'int', 'dict'}"

# With the suggestion from Sourcery
>>> f"Test - {{type(i).__name__ for i in test}}"
'Test - {type(i).__name__ for i in test}'

Debug Information

IDE Version: PyCharm 2023.1.3 (Community Edition)

Sourcery Version: 1.4.0

Operating system and Version: Ubuntu 23.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions