-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Description
Hi,
I found 2 literals that trigger an error: in
and On Hold
. I saw a closed issue for "in", but I'm not sure it was fixed or just dismissed.
Anyway this is the error message:
return parse(source_str)
^^^^^^^^^^^^^^^^^
libcst._exceptions.ParserSyntaxError: Syntax Error @ 1:1.
parser error: error at 1:2: expected one of (, *, +, -, ..., AWAIT, EOF, False, NUMBER, None, True, [, break, continue, lambda, match, not, pass, ~
in
^
Could bump-pydantic produce more helpful error message, e.g. with the whole line and line number? I took me a while to understand which "in" is the problem, because running grep in
produced a lot of output :)
These are the reproducers:
1.
from typing import Literal
from pydantic import BaseModel
class MySuperPhoneObject(BaseModel):
state: Literal["Closed", "On Hold", "Speaking", "Ringing"]
from typing import Literal
from pydantic import BaseModel
class MySuperPBXQueueObject(BaseModel):
state: Literal["in", "out"]
Metadata
Metadata
Assignees
Labels
No labels