Skip to content

Commit dd57196

Browse files
committed
perf(expression): define TokenType.STRING as "string literal" for clearer errors
1 parent 540ede3 commit dd57196

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/_pytest/mark/expression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class TokenType(enum.Enum):
5151
IDENT = "identifier"
5252
EOF = "end of input"
5353
EQUAL = "="
54-
STRING = "str"
54+
STRING = "string literal"
5555
COMMA = ","
5656

5757

testing/test_mark_expression.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ def test_invalid_idents(ident: str) -> None:
228228
r'escaping with "\\" not supported in marker expression',
229229
),
230230
("mark(empty_list=[])", r'unexpected character/s "\[\]"'),
231+
("'str'", "expected not OR left parenthesis OR identifier; got string literal"),
231232
),
232233
)
233234
def test_invalid_kwarg_name_or_value( # TODO: move to `test_syntax_errors` ?

0 commit comments

Comments
 (0)