perf(expression): define `TokenType.STRING` as "string literal" for clearer errors

This commit is contained in:
lovetheguitar 2024-06-22 20:44:50 +02:00
parent 540ede3439
commit dd57196953
2 changed files with 2 additions and 1 deletions

View File

@ -51,7 +51,7 @@ class TokenType(enum.Enum):
IDENT = "identifier" IDENT = "identifier"
EOF = "end of input" EOF = "end of input"
EQUAL = "=" EQUAL = "="
STRING = "str" STRING = "string literal"
COMMA = "," COMMA = ","

View File

@ -228,6 +228,7 @@ def test_invalid_idents(ident: str) -> None:
r'escaping with "\\" not supported in marker expression', r'escaping with "\\" not supported in marker expression',
), ),
("mark(empty_list=[])", r'unexpected character/s "\[\]"'), ("mark(empty_list=[])", r'unexpected character/s "\[\]"'),
("'str'", "expected not OR left parenthesis OR identifier; got string literal"),
), ),
) )
def test_invalid_kwarg_name_or_value( # TODO: move to `test_syntax_errors` ? def test_invalid_kwarg_name_or_value( # TODO: move to `test_syntax_errors` ?