Skip to content

Code with invalid quotes get successfully converted #4

@gousaiyang

Description

@gousaiyang

Describe the bug
Code with invalid quotes get successfully converted.

To Reproduce

>>> import f2format
>>> s = 'hello'
>>> code = "f'{s + ''}'"
>>> print(f2format.convert(code))
'{}'.format(s + '')
>>> eval(code)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1
SyntaxError: f-string: expecting '}'
>>>

Expected behavior
f2format.convert() should raise an error to report that the code is invalid

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingparsoRelated to `parso`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions