From 69b4c29924c75047655868c9895d8018d11e34e3 Mon Sep 17 00:00:00 2001 From: Luca Chiodini Date: Fri, 31 Oct 2025 16:59:11 +0100 Subject: [PATCH] Consistently wrap tokens in parser diagnostics in `backticks` instead of 'quotes' (#21163) The parser currently uses single quotes to wrap tokens. This is inconsistent with the rest of ruff/ty, which use backticks. For example, see the inconsistent diagnostics produced in this simple example: https://play.ty.dev/0a9d6eab-6599-4a1d-8e40-032091f7f50f Consistently wrapping tokens in backticks produces uniform diagnostics. Following the style decision of #723, in #2889 some quotes were already switched into backticks. This is also in line with Rust's guide on diagnostics (https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-structure): > When code or an identifier must appear in a message or label, it should be surrounded with backticks --- ...essage__grouped__tests__syntax_errors.snap | 2 +- ...ules__pycodestyle__tests__E231_E23.py.snap | 92 ++++----- ...tyle__tests__E301_E30_syntax_error.py.snap | 8 +- ...tyle__tests__E302_E30_syntax_error.py.snap | 8 +- ...tyle__tests__E303_E30_syntax_error.py.snap | 8 +- ...tyle__tests__E305_E30_syntax_error.py.snap | 8 +- ...tyle__tests__E306_E30_syntax_error.py.snap | 8 +- crates/ruff_python_parser/src/error.rs | 10 +- crates/ruff_python_parser/src/token.rs | 174 +++++++++--------- ...id_syntax@assert_invalid_test_expr.py.snap | 2 +- ..._syntax@assign_stmt_keyword_target.py.snap | 4 +- ...alid_syntax@async_unexpected_token.py.snap | 10 +- ...tax@aug_assign_stmt_invalid_target.py.snap | 2 +- ...class_def_unclosed_type_param_list.py.snap | 2 +- ...ntax@comma_separated_missing_comma.py.snap | 2 +- ...ted_missing_comma_between_elements.py.snap | 2 +- ...prehension_missing_for_after_async.py.snap | 4 +- ...yntax@decorator_missing_expression.py.snap | 2 +- ...d_syntax@decorator_missing_newline.py.snap | 6 +- ...essions__arguments__double_starred.py.snap | 2 +- ...ressions__arguments__missing_comma.py.snap | 2 +- ...expressions__arguments__unclosed_0.py.snap | 2 +- ...expressions__arguments__unclosed_1.py.snap | 2 +- ...expressions__arguments__unclosed_2.py.snap | 2 +- ...xpressions__compare__invalid_order.py.snap | 2 +- ...tax@expressions__dict__double_star.py.snap | 4 +- ...s__dict__double_star_comprehension.py.snap | 8 +- ...ons__dict__missing_closing_brace_0.py.snap | 6 +- ...ons__dict__missing_closing_brace_2.py.snap | 2 +- ...ressions__dict__named_expression_0.py.snap | 2 +- ...ressions__dict__named_expression_1.py.snap | 8 +- ..._syntax@expressions__dict__recover.py.snap | 2 +- ...sions__lambda_duplicate_parameters.py.snap | 2 +- ...s__list__missing_closing_bracket_3.py.snap | 2 +- ..._syntax@expressions__list__recover.py.snap | 2 +- ...sions__named__missing_expression_2.py.snap | 6 +- ...ressions__parenthesized__generator.py.snap | 4 +- ...nthesized__missing_closing_paren_3.py.snap | 2 +- ...@expressions__parenthesized__tuple.py.snap | 8 +- ..._parenthesized__tuple_starred_expr.py.snap | 2 +- ...set__missing_closing_curly_brace_3.py.snap | 2 +- ...d_syntax@expressions__set__recover.py.snap | 2 +- ...sions__subscript__unclosed_slice_1.py.snap | 6 +- ...pressions__yield__named_expression.py.snap | 2 +- ..._string_lambda_without_parentheses.py.snap | 2 +- ...id_syntax@f_string_unclosed_lbrace.py.snap | 4 +- ...ing_unclosed_lbrace_in_format_spec.py.snap | 4 +- ..._syntax@for_stmt_invalid_iter_expr.py.snap | 2 +- ...lid_syntax@for_stmt_invalid_target.py.snap | 2 +- ...syntax@for_stmt_missing_in_keyword.py.snap | 4 +- ...lid_syntax@for_stmt_missing_target.py.snap | 4 +- ...id_syntax@from_import_dotted_names.py.snap | 8 +- ...id_syntax@from_import_missing_rpar.py.snap | 4 +- ...nction_def_unclosed_parameter_list.py.snap | 4 +- ...ction_def_unclosed_type_param_list.py.snap | 2 +- ..._syntax@if_stmt_elif_missing_colon.py.snap | 2 +- ...valid_syntax@if_stmt_missing_colon.py.snap | 4 +- ...nvalid_syntax@match_expected_colon.py.snap | 2 +- ...@match_stmt_no_newline_before_case.py.snap | 2 +- ...ntax@multiple_clauses_on_same_line.py.snap | 24 +-- .../invalid_syntax@named_expr_slice.py.snap | 4 +- ...@nested_quote_in_format_spec_py312.py.snap | 2 +- ...nvalid_syntax@node_range_with_gaps.py.snap | 8 +- ...ntax@param_with_invalid_annotation.py.snap | 2 +- ...rams_expected_after_star_separator.py.snap | 10 +- ...@params_kwarg_after_star_separator.py.snap | 2 +- ...ax@params_var_keyword_with_default.py.snap | 6 +- ...params_var_positional_with_default.py.snap | 6 +- .../invalid_syntax@pos_only_py37.py.snap | 2 +- ...nvalid_syntax@re_lex_logical_token.py.snap | 24 +-- ...yntax@re_lex_logical_token_mac_eol.py.snap | 2 +- ...x@re_lex_logical_token_windows_eol.py.snap | 2 +- ...x@re_lexing__fstring_format_spec_1.py.snap | 6 +- ...tax@re_lexing__line_continuation_1.py.snap | 2 +- ...ing__line_continuation_windows_eol.py.snap | 2 +- ...re_lexing__triple_quoted_fstring_1.py.snap | 2 +- ...re_lexing__triple_quoted_fstring_2.py.snap | 2 +- ...re_lexing__triple_quoted_fstring_3.py.snap | 4 +- ...atements__function_type_parameters.py.snap | 8 +- ...ents__if_extra_closing_parentheses.py.snap | 2 +- ...ax@statements__match__as_pattern_2.py.snap | 2 +- ...ax@statements__match__as_pattern_3.py.snap | 4 +- ...ax@statements__match__as_pattern_4.py.snap | 4 +- ...ts__match__invalid_mapping_pattern.py.snap | 6 +- ...tements__match__star_pattern_usage.py.snap | 2 +- ...s__with__ambiguous_lpar_with_items.py.snap | 32 ++-- ...__with__unparenthesized_with_items.py.snap | 2 +- ..._string_lambda_without_parentheses.py.snap | 2 +- ...id_syntax@t_string_unclosed_lbrace.py.snap | 4 +- ...ing_unclosed_lbrace_in_format_spec.py.snap | 4 +- ...ntax@type_param_invalid_bound_expr.py.snap | 2 +- ...syntax@type_param_param_spec_bound.py.snap | 2 +- ...am_param_spec_invalid_default_expr.py.snap | 2 +- ...aram_type_var_invalid_default_expr.py.snap | 2 +- ...ax@type_param_type_var_tuple_bound.py.snap | 2 +- ...ype_var_tuple_invalid_default_expr.py.snap | 2 +- ...erminated_fstring_newline_recovery.py.snap | 2 +- ...yntax@while_stmt_invalid_test_expr.py.snap | 4 +- ...id_syntax@while_stmt_missing_colon.py.snap | 2 +- ..._items_parenthesized_missing_colon.py.snap | 2 +- ..._items_parenthesized_missing_comma.py.snap | 10 +- .../mdtest/comprehensions/invalid_syntax.md | 12 +- .../resources/mdtest/import/invalid_syntax.md | 2 +- 103 files changed, 359 insertions(+), 359 deletions(-) diff --git a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__syntax_errors.snap b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__syntax_errors.snap index 1d077b7321..f22a079523 100644 --- a/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__syntax_errors.snap +++ b/crates/ruff_linter/src/message/snapshots/ruff_linter__message__grouped__tests__syntax_errors.snap @@ -4,4 +4,4 @@ expression: content --- syntax_errors.py: 1:15 invalid-syntax: Expected one or more symbol names after import - 3:12 invalid-syntax: Expected ')', found newline + 3:12 invalid-syntax: Expected `)`, found newline diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap index c210a6768b..d436a9826a 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E231_E23.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -E231 [*] Missing whitespace after ',' +E231 [*] Missing whitespace after `,` --> E23.py:2:7 | 1 | #: E231 @@ -18,7 +18,7 @@ help: Add missing whitespace 4 | a[b1,:] 5 | #: E231 -E231 [*] Missing whitespace after ',' +E231 [*] Missing whitespace after `,` --> E23.py:4:5 | 2 | a = (1,2) @@ -38,7 +38,7 @@ help: Add missing whitespace 6 | a = [{'a':''}] 7 | #: Okay -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:6:10 | 4 | a[b1,:] @@ -58,7 +58,7 @@ help: Add missing whitespace 8 | a = (4,) 9 | b = (5, ) -E231 [*] Missing whitespace after ',' +E231 [*] Missing whitespace after `,` --> E23.py:19:10 | 17 | def foo() -> None: @@ -77,7 +77,7 @@ help: Add missing whitespace 21 | 22 | #: Okay -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:29:20 | 27 | mdtypes_template = { @@ -96,7 +96,7 @@ help: Add missing whitespace 31 | 32 | # E231 -E231 [*] Missing whitespace after ',' +E231 [*] Missing whitespace after `,` --> E23.py:33:6 | 32 | # E231 @@ -115,7 +115,7 @@ help: Add missing whitespace 35 | # Okay because it's hard to differentiate between the usages of a colon in a f-string 36 | f"{a:=1}" -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:47:37 | 46 | #: E231 @@ -134,7 +134,7 @@ help: Add missing whitespace 49 | #: Okay 50 | a = (1,) -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:60:13 | 58 | results = { @@ -154,7 +154,7 @@ help: Add missing whitespace 62 | results_in_tuple = ( 63 | { -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:65:17 | 63 | { @@ -174,7 +174,7 @@ help: Add missing whitespace 67 | ) 68 | results_in_list = [ -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:71:17 | 69 | { @@ -194,7 +194,7 @@ help: Add missing whitespace 73 | ] 74 | results_in_list_first = [ -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:76:17 | 74 | results_in_list_first = [ @@ -214,7 +214,7 @@ help: Add missing whitespace 78 | ] 79 | -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:82:13 | 80 | x = [ @@ -234,7 +234,7 @@ help: Add missing whitespace 84 | "k3":[2], # E231 85 | "k4": [2], -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:84:13 | 82 | "k1":[2], # E231 @@ -254,7 +254,7 @@ help: Add missing whitespace 86 | "k5": [2], 87 | "k6": [1, 2, 3, 4,5,6,7] # E231 -E231 [*] Missing whitespace after ',' +E231 [*] Missing whitespace after `,` --> E23.py:87:26 | 85 | "k4": [2], @@ -274,7 +274,7 @@ help: Add missing whitespace 89 | { 90 | "k1": [ -E231 [*] Missing whitespace after ',' +E231 [*] Missing whitespace after `,` --> E23.py:87:28 | 85 | "k4": [2], @@ -294,7 +294,7 @@ help: Add missing whitespace 89 | { 90 | "k1": [ -E231 [*] Missing whitespace after ',' +E231 [*] Missing whitespace after `,` --> E23.py:87:30 | 85 | "k4": [2], @@ -314,7 +314,7 @@ help: Add missing whitespace 89 | { 90 | "k1": [ -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:92:21 | 90 | "k1": [ @@ -334,7 +334,7 @@ help: Add missing whitespace 94 | { 95 | "kb": [2,3], # E231 -E231 [*] Missing whitespace after ',' +E231 [*] Missing whitespace after `,` --> E23.py:92:24 | 90 | "k1": [ @@ -354,7 +354,7 @@ help: Add missing whitespace 94 | { 95 | "kb": [2,3], # E231 -E231 [*] Missing whitespace after ',' +E231 [*] Missing whitespace after `,` --> E23.py:95:25 | 93 | }, @@ -374,7 +374,7 @@ help: Add missing whitespace 97 | { 98 | "ka":[2, 3], # E231 -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:98:21 | 96 | }, @@ -394,7 +394,7 @@ help: Add missing whitespace 100 | "kc": [2, 3], # Ok 101 | "kd": [2,3], # E231 -E231 [*] Missing whitespace after ',' +E231 [*] Missing whitespace after `,` --> E23.py:101:25 | 99 | "kb": [2, 3], # Ok @@ -414,7 +414,7 @@ help: Add missing whitespace 103 | }, 104 | ] -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:102:21 | 100 | "kc": [2, 3], # Ok @@ -434,7 +434,7 @@ help: Add missing whitespace 104 | ] 105 | } -E231 [*] Missing whitespace after ',' +E231 [*] Missing whitespace after `,` --> E23.py:102:24 | 100 | "kc": [2, 3], # Ok @@ -454,7 +454,7 @@ help: Add missing whitespace 104 | ] 105 | } -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:109:18 | 108 | # Should be E231 errors on all of these type parameters and function parameters, but not on their (strange) defaults @@ -473,7 +473,7 @@ help: Add missing whitespace 111 | y:B = [[["foo", "bar"]]], 112 | z:object = "fooo", -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:109:40 | 108 | # Should be E231 errors on all of these type parameters and function parameters, but not on their (strange) defaults @@ -492,7 +492,7 @@ help: Add missing whitespace 111 | y:B = [[["foo", "bar"]]], 112 | z:object = "fooo", -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:109:70 | 108 | # Should be E231 errors on all of these type parameters and function parameters, but not on their (strange) defaults @@ -511,7 +511,7 @@ help: Add missing whitespace 111 | y:B = [[["foo", "bar"]]], 112 | z:object = "fooo", -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:110:6 | 108 | # Should be E231 errors on all of these type parameters and function parameters, but not on their (strange) defaults @@ -531,7 +531,7 @@ help: Add missing whitespace 112 | z:object = "fooo", 113 | ): -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:111:6 | 109 | def pep_696_bad[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]( @@ -551,7 +551,7 @@ help: Add missing whitespace 113 | ): 114 | pass -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:112:6 | 110 | x:A = "foo"[::-1], @@ -571,7 +571,7 @@ help: Add missing whitespace 114 | pass 115 | -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:116:18 | 114 | pass @@ -591,7 +591,7 @@ help: Add missing whitespace 118 | self, 119 | x:A = "foo"[::-1], -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:116:40 | 114 | pass @@ -611,7 +611,7 @@ help: Add missing whitespace 118 | self, 119 | x:A = "foo"[::-1], -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:116:70 | 114 | pass @@ -631,7 +631,7 @@ help: Add missing whitespace 118 | self, 119 | x:A = "foo"[::-1], -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:117:29 | 116 | class PEP696Bad[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]: @@ -650,7 +650,7 @@ help: Add missing whitespace 119 | x:A = "foo"[::-1], 120 | y:B = [[["foo", "bar"]]], -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:117:51 | 116 | class PEP696Bad[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]: @@ -669,7 +669,7 @@ help: Add missing whitespace 119 | x:A = "foo"[::-1], 120 | y:B = [[["foo", "bar"]]], -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:117:81 | 116 | class PEP696Bad[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]: @@ -688,7 +688,7 @@ help: Add missing whitespace 119 | x:A = "foo"[::-1], 120 | y:B = [[["foo", "bar"]]], -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:119:10 | 117 | def pep_696_bad_method[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes]( @@ -708,7 +708,7 @@ help: Add missing whitespace 121 | z:object = "fooo", 122 | ): -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:120:10 | 118 | self, @@ -728,7 +728,7 @@ help: Add missing whitespace 122 | ): 123 | pass -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:121:10 | 119 | x:A = "foo"[::-1], @@ -748,7 +748,7 @@ help: Add missing whitespace 123 | pass 124 | -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:125:32 | 123 | pass @@ -768,7 +768,7 @@ help: Add missing whitespace 127 | pass 128 | -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:125:54 | 123 | pass @@ -788,7 +788,7 @@ help: Add missing whitespace 127 | pass 128 | -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:125:84 | 123 | pass @@ -808,7 +808,7 @@ help: Add missing whitespace 127 | pass 128 | -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:126:47 | 125 | class PEP696BadWithEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](): @@ -826,7 +826,7 @@ help: Add missing whitespace 128 | 129 | # Should be no E231 errors on any of these: -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:126:69 | 125 | class PEP696BadWithEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](): @@ -844,7 +844,7 @@ help: Add missing whitespace 128 | 129 | # Should be no E231 errors on any of these: -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:126:99 | 125 | class PEP696BadWithEmptyBases[A:object="foo"[::-1], B:object =[[["foo", "bar"]]], C:object= bytes](): @@ -862,7 +862,7 @@ help: Add missing whitespace 128 | 129 | # Should be no E231 errors on any of these: -E231 [*] Missing whitespace after ',' +E231 [*] Missing whitespace after `,` --> E23.py:147:6 | 146 | # E231 @@ -881,7 +881,7 @@ help: Add missing whitespace 149 | # Okay because it's hard to differentiate between the usages of a colon in a t-string 150 | t"{a:=1}" -E231 [*] Missing whitespace after ':' +E231 [*] Missing whitespace after `:` --> E23.py:161:37 | 160 | #: E231 diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30_syntax_error.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30_syntax_error.py.snap index 7cf04e5cc7..b8c6413c1d 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E301_E30_syntax_error.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -invalid-syntax: Expected ']', found '(' +invalid-syntax: Expected `]`, found `(` --> E30_syntax_error.py:4:15 | 2 | # parenthesis. @@ -11,7 +11,7 @@ invalid-syntax: Expected ']', found '(' 5 | pass | -invalid-syntax: Expected ')', found newline +invalid-syntax: Expected `)`, found newline --> E30_syntax_error.py:13:18 | 12 | class Foo: @@ -32,7 +32,7 @@ E301 Expected 1 blank line, found 0 | help: Add missing blank line -invalid-syntax: Expected ')', found newline +invalid-syntax: Expected `)`, found newline --> E30_syntax_error.py:18:11 | 16 | pass @@ -41,7 +41,7 @@ invalid-syntax: Expected ')', found newline | ^ | -invalid-syntax: Expected ')', found newline +invalid-syntax: Expected `)`, found newline --> E30_syntax_error.py:21:9 | 21 | def top( diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30_syntax_error.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30_syntax_error.py.snap index e28bb8562d..76c3d31211 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E302_E30_syntax_error.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -invalid-syntax: Expected ']', found '(' +invalid-syntax: Expected `]`, found `(` --> E30_syntax_error.py:4:15 | 2 | # parenthesis. @@ -22,7 +22,7 @@ E302 Expected 2 blank lines, found 1 | help: Add missing blank line(s) -invalid-syntax: Expected ')', found newline +invalid-syntax: Expected `)`, found newline --> E30_syntax_error.py:13:18 | 12 | class Foo: @@ -32,7 +32,7 @@ invalid-syntax: Expected ')', found newline 15 | def method(): | -invalid-syntax: Expected ')', found newline +invalid-syntax: Expected `)`, found newline --> E30_syntax_error.py:18:11 | 16 | pass @@ -41,7 +41,7 @@ invalid-syntax: Expected ')', found newline | ^ | -invalid-syntax: Expected ')', found newline +invalid-syntax: Expected `)`, found newline --> E30_syntax_error.py:21:9 | 21 | def top( diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30_syntax_error.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30_syntax_error.py.snap index c70c94baad..af23f16de9 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E303_E30_syntax_error.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -invalid-syntax: Expected ']', found '(' +invalid-syntax: Expected `]`, found `(` --> E30_syntax_error.py:4:15 | 2 | # parenthesis. @@ -21,7 +21,7 @@ E303 Too many blank lines (3) | help: Remove extraneous blank line(s) -invalid-syntax: Expected ')', found newline +invalid-syntax: Expected `)`, found newline --> E30_syntax_error.py:13:18 | 12 | class Foo: @@ -31,7 +31,7 @@ invalid-syntax: Expected ')', found newline 15 | def method(): | -invalid-syntax: Expected ')', found newline +invalid-syntax: Expected `)`, found newline --> E30_syntax_error.py:18:11 | 16 | pass @@ -40,7 +40,7 @@ invalid-syntax: Expected ')', found newline | ^ | -invalid-syntax: Expected ')', found newline +invalid-syntax: Expected `)`, found newline --> E30_syntax_error.py:21:9 | 21 | def top( diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30_syntax_error.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30_syntax_error.py.snap index dd97fe9010..f72c198e1e 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E305_E30_syntax_error.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -invalid-syntax: Expected ']', found '(' +invalid-syntax: Expected `]`, found `(` --> E30_syntax_error.py:4:15 | 2 | # parenthesis. @@ -11,7 +11,7 @@ invalid-syntax: Expected ']', found '(' 5 | pass | -invalid-syntax: Expected ')', found newline +invalid-syntax: Expected `)`, found newline --> E30_syntax_error.py:13:18 | 12 | class Foo: @@ -31,7 +31,7 @@ E305 Expected 2 blank lines after class or function definition, found (1) | help: Add missing blank line(s) -invalid-syntax: Expected ')', found newline +invalid-syntax: Expected `)`, found newline --> E30_syntax_error.py:18:11 | 16 | pass @@ -40,7 +40,7 @@ invalid-syntax: Expected ')', found newline | ^ | -invalid-syntax: Expected ')', found newline +invalid-syntax: Expected `)`, found newline --> E30_syntax_error.py:21:9 | 21 | def top( diff --git a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30_syntax_error.py.snap b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30_syntax_error.py.snap index d3a6b15d4e..98d00f77af 100644 --- a/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30_syntax_error.py.snap +++ b/crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__E306_E30_syntax_error.py.snap @@ -1,7 +1,7 @@ --- source: crates/ruff_linter/src/rules/pycodestyle/mod.rs --- -invalid-syntax: Expected ']', found '(' +invalid-syntax: Expected `]`, found `(` --> E30_syntax_error.py:4:15 | 2 | # parenthesis. @@ -11,7 +11,7 @@ invalid-syntax: Expected ']', found '(' 5 | pass | -invalid-syntax: Expected ')', found newline +invalid-syntax: Expected `)`, found newline --> E30_syntax_error.py:13:18 | 12 | class Foo: @@ -21,7 +21,7 @@ invalid-syntax: Expected ')', found newline 15 | def method(): | -invalid-syntax: Expected ')', found newline +invalid-syntax: Expected `)`, found newline --> E30_syntax_error.py:18:11 | 16 | pass @@ -30,7 +30,7 @@ invalid-syntax: Expected ')', found newline | ^ | -invalid-syntax: Expected ')', found newline +invalid-syntax: Expected `)`, found newline --> E30_syntax_error.py:21:9 | 21 | def top( diff --git a/crates/ruff_python_parser/src/error.rs b/crates/ruff_python_parser/src/error.rs index 2c2baa8dd7..8b02546d3b 100644 --- a/crates/ruff_python_parser/src/error.rs +++ b/crates/ruff_python_parser/src/error.rs @@ -78,9 +78,9 @@ pub enum InterpolatedStringErrorType { impl std::fmt::Display for InterpolatedStringErrorType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { - Self::UnclosedLbrace => write!(f, "expecting '}}'"), + Self::UnclosedLbrace => write!(f, "expecting `}}`"), Self::InvalidConversionFlag => write!(f, "invalid conversion character"), - Self::SingleRbrace => write!(f, "single '}}' is not allowed"), + Self::SingleRbrace => write!(f, "single `}}` is not allowed"), Self::UnterminatedString => write!(f, "unterminated string"), Self::UnterminatedTripleQuotedString => write!(f, "unterminated triple-quoted string"), Self::LambdaWithoutParentheses => { @@ -232,7 +232,7 @@ impl std::fmt::Display for ParseErrorType { ParseErrorType::UnexpectedTokenAfterAsync(kind) => { write!( f, - "Expected 'def', 'with' or 'for' to follow 'async', found {kind}", + "Expected `def`, `with` or `for` to follow `async`, found {kind}", ) } ParseErrorType::InvalidArgumentUnpackingOrder => { @@ -286,10 +286,10 @@ impl std::fmt::Display for ParseErrorType { f.write_str("Parameter without a default cannot follow a parameter with a default") } ParseErrorType::ExpectedKeywordParam => { - f.write_str("Expected one or more keyword parameter after '*' separator") + f.write_str("Expected one or more keyword parameter after `*` separator") } ParseErrorType::VarParameterWithDefault => { - f.write_str("Parameter with '*' or '**' cannot have default value") + f.write_str("Parameter with `*` or `**` cannot have default value") } ParseErrorType::InvalidStarPatternUsage => { f.write_str("Star pattern cannot be used here") diff --git a/crates/ruff_python_parser/src/token.rs b/crates/ruff_python_parser/src/token.rs index 18b7648c4c..a5790a9597 100644 --- a/crates/ruff_python_parser/src/token.rs +++ b/crates/ruff_python_parser/src/token.rs @@ -635,93 +635,93 @@ impl fmt::Display for TokenKind { TokenKind::TStringEnd => "TStringEnd", TokenKind::IpyEscapeCommand => "IPython escape command", TokenKind::Comment => "comment", - TokenKind::Question => "'?'", - TokenKind::Exclamation => "'!'", - TokenKind::Lpar => "'('", - TokenKind::Rpar => "')'", - TokenKind::Lsqb => "'['", - TokenKind::Rsqb => "']'", - TokenKind::Lbrace => "'{'", - TokenKind::Rbrace => "'}'", - TokenKind::Equal => "'='", - TokenKind::ColonEqual => "':='", - TokenKind::Dot => "'.'", - TokenKind::Colon => "':'", - TokenKind::Semi => "';'", - TokenKind::Comma => "','", - TokenKind::Rarrow => "'->'", - TokenKind::Plus => "'+'", - TokenKind::Minus => "'-'", - TokenKind::Star => "'*'", - TokenKind::DoubleStar => "'**'", - TokenKind::Slash => "'/'", - TokenKind::DoubleSlash => "'//'", - TokenKind::Percent => "'%'", - TokenKind::Vbar => "'|'", - TokenKind::Amper => "'&'", - TokenKind::CircumFlex => "'^'", - TokenKind::LeftShift => "'<<'", - TokenKind::RightShift => "'>>'", - TokenKind::Tilde => "'~'", - TokenKind::At => "'@'", - TokenKind::Less => "'<'", - TokenKind::Greater => "'>'", - TokenKind::EqEqual => "'=='", - TokenKind::NotEqual => "'!='", - TokenKind::LessEqual => "'<='", - TokenKind::GreaterEqual => "'>='", - TokenKind::PlusEqual => "'+='", - TokenKind::MinusEqual => "'-='", - TokenKind::StarEqual => "'*='", - TokenKind::DoubleStarEqual => "'**='", - TokenKind::SlashEqual => "'/='", - TokenKind::DoubleSlashEqual => "'//='", - TokenKind::PercentEqual => "'%='", - TokenKind::VbarEqual => "'|='", - TokenKind::AmperEqual => "'&='", - TokenKind::CircumflexEqual => "'^='", - TokenKind::LeftShiftEqual => "'<<='", - TokenKind::RightShiftEqual => "'>>='", - TokenKind::AtEqual => "'@='", - TokenKind::Ellipsis => "'...'", - TokenKind::False => "'False'", - TokenKind::None => "'None'", - TokenKind::True => "'True'", - TokenKind::And => "'and'", - TokenKind::As => "'as'", - TokenKind::Assert => "'assert'", - TokenKind::Async => "'async'", - TokenKind::Await => "'await'", - TokenKind::Break => "'break'", - TokenKind::Class => "'class'", - TokenKind::Continue => "'continue'", - TokenKind::Def => "'def'", - TokenKind::Del => "'del'", - TokenKind::Elif => "'elif'", - TokenKind::Else => "'else'", - TokenKind::Except => "'except'", - TokenKind::Finally => "'finally'", - TokenKind::For => "'for'", - TokenKind::From => "'from'", - TokenKind::Global => "'global'", - TokenKind::If => "'if'", - TokenKind::Import => "'import'", - TokenKind::In => "'in'", - TokenKind::Is => "'is'", - TokenKind::Lambda => "'lambda'", - TokenKind::Nonlocal => "'nonlocal'", - TokenKind::Not => "'not'", - TokenKind::Or => "'or'", - TokenKind::Pass => "'pass'", - TokenKind::Raise => "'raise'", - TokenKind::Return => "'return'", - TokenKind::Try => "'try'", - TokenKind::While => "'while'", - TokenKind::Match => "'match'", - TokenKind::Type => "'type'", - TokenKind::Case => "'case'", - TokenKind::With => "'with'", - TokenKind::Yield => "'yield'", + TokenKind::Question => "`?`", + TokenKind::Exclamation => "`!`", + TokenKind::Lpar => "`(`", + TokenKind::Rpar => "`)`", + TokenKind::Lsqb => "`[`", + TokenKind::Rsqb => "`]`", + TokenKind::Lbrace => "`{`", + TokenKind::Rbrace => "`}`", + TokenKind::Equal => "`=`", + TokenKind::ColonEqual => "`:=`", + TokenKind::Dot => "`.`", + TokenKind::Colon => "`:`", + TokenKind::Semi => "`;`", + TokenKind::Comma => "`,`", + TokenKind::Rarrow => "`->`", + TokenKind::Plus => "`+`", + TokenKind::Minus => "`-`", + TokenKind::Star => "`*`", + TokenKind::DoubleStar => "`**`", + TokenKind::Slash => "`/`", + TokenKind::DoubleSlash => "`//`", + TokenKind::Percent => "`%`", + TokenKind::Vbar => "`|`", + TokenKind::Amper => "`&`", + TokenKind::CircumFlex => "`^`", + TokenKind::LeftShift => "`<<`", + TokenKind::RightShift => "`>>`", + TokenKind::Tilde => "`~`", + TokenKind::At => "`@`", + TokenKind::Less => "`<`", + TokenKind::Greater => "`>`", + TokenKind::EqEqual => "`==`", + TokenKind::NotEqual => "`!=`", + TokenKind::LessEqual => "`<=`", + TokenKind::GreaterEqual => "`>=`", + TokenKind::PlusEqual => "`+=`", + TokenKind::MinusEqual => "`-=`", + TokenKind::StarEqual => "`*=`", + TokenKind::DoubleStarEqual => "`**=`", + TokenKind::SlashEqual => "`/=`", + TokenKind::DoubleSlashEqual => "`//=`", + TokenKind::PercentEqual => "`%=`", + TokenKind::VbarEqual => "`|=`", + TokenKind::AmperEqual => "`&=`", + TokenKind::CircumflexEqual => "`^=`", + TokenKind::LeftShiftEqual => "`<<=`", + TokenKind::RightShiftEqual => "`>>=`", + TokenKind::AtEqual => "`@=`", + TokenKind::Ellipsis => "`...`", + TokenKind::False => "`False`", + TokenKind::None => "`None`", + TokenKind::True => "`True`", + TokenKind::And => "`and`", + TokenKind::As => "`as`", + TokenKind::Assert => "`assert`", + TokenKind::Async => "`async`", + TokenKind::Await => "`await`", + TokenKind::Break => "`break`", + TokenKind::Class => "`class`", + TokenKind::Continue => "`continue`", + TokenKind::Def => "`def`", + TokenKind::Del => "`del`", + TokenKind::Elif => "`elif`", + TokenKind::Else => "`else`", + TokenKind::Except => "`except`", + TokenKind::Finally => "`finally`", + TokenKind::For => "`for`", + TokenKind::From => "`from`", + TokenKind::Global => "`global`", + TokenKind::If => "`if`", + TokenKind::Import => "`import`", + TokenKind::In => "`in`", + TokenKind::Is => "`is`", + TokenKind::Lambda => "`lambda`", + TokenKind::Nonlocal => "`nonlocal`", + TokenKind::Not => "`not`", + TokenKind::Or => "`or`", + TokenKind::Pass => "`pass`", + TokenKind::Raise => "`raise`", + TokenKind::Return => "`return`", + TokenKind::Try => "`try`", + TokenKind::While => "`while`", + TokenKind::Match => "`match`", + TokenKind::Type => "`type`", + TokenKind::Case => "`case`", + TokenKind::With => "`with`", + TokenKind::Yield => "`yield`", }; f.write_str(value) } diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_invalid_test_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_invalid_test_expr.py.snap index 1a843b29c9..87c0dcf672 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_invalid_test_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_invalid_test_expr.py.snap @@ -131,7 +131,7 @@ Module( | 1 | assert *x 2 | assert assert x - | ^^^^^^ Syntax Error: Expected an identifier, but found a keyword 'assert' that cannot be used here + | ^^^^^^ Syntax Error: Expected an identifier, but found a keyword `assert` that cannot be used here 3 | assert yield x 4 | assert x := 1 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_keyword_target.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_keyword_target.py.snap index 6264d907b5..e59c71cea8 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_keyword_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@assign_stmt_keyword_target.py.snap @@ -148,7 +148,7 @@ Module( | 1 | a = pass = c - | ^^^^ Syntax Error: Expected an identifier, but found a keyword 'pass' that cannot be used here + | ^^^^ Syntax Error: Expected an identifier, but found a keyword `pass` that cannot be used here 2 | a + b 3 | a = b = pass = c | @@ -158,6 +158,6 @@ Module( 1 | a = pass = c 2 | a + b 3 | a = b = pass = c - | ^^^^ Syntax Error: Expected an identifier, but found a keyword 'pass' that cannot be used here + | ^^^^ Syntax Error: Expected an identifier, but found a keyword `pass` that cannot be used here 4 | a + b | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@async_unexpected_token.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@async_unexpected_token.py.snap index 2dd2bddfc4..dc62f1b446 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@async_unexpected_token.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@async_unexpected_token.py.snap @@ -181,7 +181,7 @@ Module( | 1 | async class Foo: ... - | ^^^^^ Syntax Error: Expected 'def', 'with' or 'for' to follow 'async', found 'class' + | ^^^^^ Syntax Error: Expected `def`, `with` or `for` to follow `async`, found `class` 2 | async while test: ... 3 | async x = 1 | @@ -190,7 +190,7 @@ Module( | 1 | async class Foo: ... 2 | async while test: ... - | ^^^^^ Syntax Error: Expected 'def', 'with' or 'for' to follow 'async', found 'while' + | ^^^^^ Syntax Error: Expected `def`, `with` or `for` to follow `async`, found `while` 3 | async x = 1 4 | async async def foo(): ... | @@ -200,7 +200,7 @@ Module( 1 | async class Foo: ... 2 | async while test: ... 3 | async x = 1 - | ^ Syntax Error: Expected 'def', 'with' or 'for' to follow 'async', found name + | ^ Syntax Error: Expected `def`, `with` or `for` to follow `async`, found name 4 | async async def foo(): ... 5 | async match test: | @@ -210,7 +210,7 @@ Module( 2 | async while test: ... 3 | async x = 1 4 | async async def foo(): ... - | ^^^^^ Syntax Error: Expected 'def', 'with' or 'for' to follow 'async', found 'async' + | ^^^^^ Syntax Error: Expected `def`, `with` or `for` to follow `async`, found `async` 5 | async match test: 6 | case _: ... | @@ -220,6 +220,6 @@ Module( 3 | async x = 1 4 | async async def foo(): ... 5 | async match test: - | ^^^^^ Syntax Error: Expected 'def', 'with' or 'for' to follow 'async', found 'match' + | ^^^^^ Syntax Error: Expected `def`, `with` or `for` to follow `async`, found `match` 6 | case _: ... | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@aug_assign_stmt_invalid_target.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@aug_assign_stmt_invalid_target.py.snap index 0d1311ca25..dbe201539e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@aug_assign_stmt_invalid_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@aug_assign_stmt_invalid_target.py.snap @@ -245,7 +245,7 @@ Module( 3 | *x += 1 4 | pass += 1 5 | x += pass - | ^^^^ Syntax Error: Expected an identifier, but found a keyword 'pass' that cannot be used here + | ^^^^ Syntax Error: Expected an identifier, but found a keyword `pass` that cannot be used here 6 | (x + y) += 1 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@class_def_unclosed_type_param_list.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@class_def_unclosed_type_param_list.py.snap index 3246bdb0ce..515534ed26 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@class_def_unclosed_type_param_list.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@class_def_unclosed_type_param_list.py.snap @@ -121,7 +121,7 @@ Module( | 1 | class Foo[T1, *T2(a, b): - | ^ Syntax Error: Expected ']', found '(' + | ^ Syntax Error: Expected `]`, found `(` 2 | pass 3 | x = 10 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comma_separated_missing_comma.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comma_separated_missing_comma.py.snap index bf33de094f..84c88e8d1f 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comma_separated_missing_comma.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comma_separated_missing_comma.py.snap @@ -68,7 +68,7 @@ Module( | 1 | call(**x := 1) - | ^^ Syntax Error: Expected ',', found ':=' + | ^^ Syntax Error: Expected `,`, found `:=` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comma_separated_missing_comma_between_elements.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comma_separated_missing_comma_between_elements.py.snap index 5f39e94515..4da8a91dea 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comma_separated_missing_comma_between_elements.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comma_separated_missing_comma_between_elements.py.snap @@ -61,5 +61,5 @@ Module( | 1 | # The comma between the first two elements is expected in `parse_list_expression`. 2 | [0, 1 2] - | ^ Syntax Error: Expected ',', found int + | ^ Syntax Error: Expected `,`, found int | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comprehension_missing_for_after_async.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comprehension_missing_for_after_async.py.snap index aee9bf7056..a31a055919 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comprehension_missing_for_after_async.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@comprehension_missing_for_after_async.py.snap @@ -77,7 +77,7 @@ Module( | 1 | (async) - | ^^^^^ Syntax Error: Expected an identifier, but found a keyword 'async' that cannot be used here + | ^^^^^ Syntax Error: Expected an identifier, but found a keyword `async` that cannot be used here 2 | (x async x in iter) | @@ -85,5 +85,5 @@ Module( | 1 | (async) 2 | (x async x in iter) - | ^ Syntax Error: Expected 'for', found name + | ^ Syntax Error: Expected `for`, found name | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_missing_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_missing_expression.py.snap index 2c5bbd3a03..dd7225493f 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_missing_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_missing_expression.py.snap @@ -169,7 +169,7 @@ Module( | 1 | @def foo(): ... - | ^^^ Syntax Error: Expected an identifier, but found a keyword 'def' that cannot be used here + | ^^^ Syntax Error: Expected an identifier, but found a keyword `def` that cannot be used here 2 | @ 3 | def foo(): ... | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_missing_newline.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_missing_newline.py.snap index 948fc24fe2..ea573c4cde 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_missing_newline.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_missing_newline.py.snap @@ -161,7 +161,7 @@ Module( | 1 | @x def foo(): ... - | ^^^ Syntax Error: Expected newline, found 'def' + | ^^^ Syntax Error: Expected newline, found `def` 2 | @x async def foo(): ... 3 | @x class Foo: ... | @@ -170,7 +170,7 @@ Module( | 1 | @x def foo(): ... 2 | @x async def foo(): ... - | ^^^^^ Syntax Error: Expected newline, found 'async' + | ^^^^^ Syntax Error: Expected newline, found `async` 3 | @x class Foo: ... | @@ -179,5 +179,5 @@ Module( 1 | @x def foo(): ... 2 | @x async def foo(): ... 3 | @x class Foo: ... - | ^^^^^ Syntax Error: Expected newline, found 'class' + | ^^^^^ Syntax Error: Expected newline, found `class` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__double_starred.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__double_starred.py.snap index e3f633b879..8656ee03e8 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__double_starred.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__double_starred.py.snap @@ -238,7 +238,7 @@ Module( 3 | call(***x) 4 | 5 | call(**x := 1) - | ^^ Syntax Error: Expected ',', found ':=' + | ^^ Syntax Error: Expected `,`, found `:=` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_comma.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_comma.py.snap index 37e891b89a..0f781f1e53 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_comma.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__missing_comma.py.snap @@ -61,5 +61,5 @@ Module( | 1 | call(x y) - | ^ Syntax Error: Expected ',', found name + | ^ Syntax Error: Expected `,`, found name | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_0.py.snap index 655f45ed24..cc6fba138b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_0.py.snap @@ -76,7 +76,7 @@ Module( | 1 | call( - | ^ Syntax Error: Expected ')', found newline + | ^ Syntax Error: Expected `)`, found newline 2 | 3 | def foo(): 4 | pass diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_1.py.snap index 99e0e4fbcd..cdb11a8ebc 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_1.py.snap @@ -85,7 +85,7 @@ Module( | 1 | call(x - | ^ Syntax Error: Expected ')', found newline + | ^ Syntax Error: Expected `)`, found newline 2 | 3 | def foo(): 4 | pass diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_2.py.snap index 2b4270bf2c..e28cecdd9f 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__arguments__unclosed_2.py.snap @@ -85,7 +85,7 @@ Module( | 1 | call(x, - | ^ Syntax Error: Expected ')', found newline + | ^ Syntax Error: Expected `)`, found newline 2 | 3 | def foo(): 4 | pass diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_order.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_order.py.snap index 419cc7854b..ccc649ea7c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_order.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__compare__invalid_order.py.snap @@ -175,7 +175,7 @@ Module( | 6 | # Same here as well, `not` without `in` is considered to be a unary operator 7 | x not is y - | ^^ Syntax Error: Expected an identifier, but found a keyword 'is' that cannot be used here + | ^^ Syntax Error: Expected an identifier, but found a keyword `is` that cannot be used here | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star.py.snap index a579afac89..64fb0233e4 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star.py.snap @@ -544,7 +544,7 @@ Module( 2 | # the ones which are higher than that. 3 | 4 | {**x := 1} - | ^^ Syntax Error: Expected ',', found ':=' + | ^^ Syntax Error: Expected `,`, found `:=` 5 | {a: 1, **x if True else y} 6 | {**lambda x: x, b: 2} | @@ -554,7 +554,7 @@ Module( 2 | # the ones which are higher than that. 3 | 4 | {**x := 1} - | ^ Syntax Error: Expected ':', found '}' + | ^ Syntax Error: Expected `:`, found `}` 5 | {a: 1, **x if True else y} 6 | {**lambda x: x, b: 2} | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star_comprehension.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star_comprehension.py.snap index 9c0cde63d3..e5e7f7e3ee 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star_comprehension.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__double_star_comprehension.py.snap @@ -134,7 +134,7 @@ Module( 2 | # it's actually a comprehension. 3 | 4 | {**x: y for x, y in data} - | ^^^ Syntax Error: Expected ':', found 'for' + | ^^^ Syntax Error: Expected `:`, found `for` 5 | 6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y` | @@ -144,7 +144,7 @@ Module( 2 | # it's actually a comprehension. 3 | 4 | {**x: y for x, y in data} - | ^ Syntax Error: Expected ',', found name + | ^ Syntax Error: Expected `,`, found name 5 | 6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y` | @@ -154,7 +154,7 @@ Module( 2 | # it's actually a comprehension. 3 | 4 | {**x: y for x, y in data} - | ^ Syntax Error: Expected ':', found ',' + | ^ Syntax Error: Expected `:`, found `,` 5 | 6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y` | @@ -164,7 +164,7 @@ Module( 2 | # it's actually a comprehension. 3 | 4 | {**x: y for x, y in data} - | ^ Syntax Error: Expected ':', found '}' + | ^ Syntax Error: Expected `:`, found `}` 5 | 6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_0.py.snap index 99d310bc87..31bd7feb9f 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_0.py.snap @@ -86,7 +86,7 @@ Module( 1 | {x: 2 | 3 | def foo(): - | ^^^ Syntax Error: Expected an identifier, but found a keyword 'def' that cannot be used here + | ^^^ Syntax Error: Expected an identifier, but found a keyword `def` that cannot be used here 4 | pass | @@ -95,7 +95,7 @@ Module( 1 | {x: 2 | 3 | def foo(): - | ^^^ Syntax Error: Expected ',', found name + | ^^^ Syntax Error: Expected `,`, found name 4 | pass | @@ -103,7 +103,7 @@ Module( | 3 | def foo(): 4 | pass - | ^^^^ Syntax Error: Expected an identifier, but found a keyword 'pass' that cannot be used here + | ^^^^ Syntax Error: Expected an identifier, but found a keyword `pass` that cannot be used here | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_2.py.snap index a5a08be0be..a54264becd 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__missing_closing_brace_2.py.snap @@ -85,7 +85,7 @@ Module( | 1 | {x: 1, - | ^ Syntax Error: Expected '}', found newline + | ^ Syntax Error: Expected `}`, found newline 2 | 3 | def foo(): 4 | pass diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_0.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_0.py.snap index 5db7a61381..824f3261f7 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_0.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_0.py.snap @@ -149,7 +149,7 @@ Module( 1 | # Unparenthesized named expression not allowed in key 2 | 3 | {x := 1: y, z := 2: a} - | ^^ Syntax Error: Expected ':', found ':=' + | ^^ Syntax Error: Expected `:`, found `:=` 4 | 5 | x + y | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_1.py.snap index 58509cc935..ccf8ead1b9 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__named_expression_1.py.snap @@ -145,7 +145,7 @@ Module( 1 | # Unparenthesized named expression not allowed in value 2 | 3 | {x: y := 1, z: a := 2} - | ^^ Syntax Error: Expected ',', found ':=' + | ^^ Syntax Error: Expected `,`, found `:=` 4 | 5 | x + y | @@ -155,7 +155,7 @@ Module( 1 | # Unparenthesized named expression not allowed in value 2 | 3 | {x: y := 1, z: a := 2} - | ^ Syntax Error: Expected ':', found ',' + | ^ Syntax Error: Expected `:`, found `,` 4 | 5 | x + y | @@ -165,7 +165,7 @@ Module( 1 | # Unparenthesized named expression not allowed in value 2 | 3 | {x: y := 1, z: a := 2} - | ^^ Syntax Error: Expected ',', found ':=' + | ^^ Syntax Error: Expected `,`, found `:=` 4 | 5 | x + y | @@ -175,7 +175,7 @@ Module( 1 | # Unparenthesized named expression not allowed in value 2 | 3 | {x: y := 1, z: a := 2} - | ^ Syntax Error: Expected ':', found '}' + | ^ Syntax Error: Expected `:`, found `}` 4 | 5 | x + y | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__recover.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__recover.py.snap index c4c4f242c8..b1ad5d8255 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__recover.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__dict__recover.py.snap @@ -504,7 +504,7 @@ Module( | 9 | # Missing comma 10 | {1: 2 3: 4} - | ^ Syntax Error: Expected ',', found int + | ^ Syntax Error: Expected `,`, found int 11 | 12 | # No value | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__lambda_duplicate_parameters.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__lambda_duplicate_parameters.py.snap index 986a07de03..39ddc3c4c5 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__lambda_duplicate_parameters.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__lambda_duplicate_parameters.py.snap @@ -338,7 +338,7 @@ Module( 7 | lambda a, *a: 1 8 | 9 | lambda a, *, **a: 1 - | ^^^ Syntax Error: Expected one or more keyword parameter after '*' separator + | ^^^ Syntax Error: Expected one or more keyword parameter after `*` separator | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_3.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_3.py.snap index 4f21ca4ddf..1870af8aa0 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_3.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__missing_closing_bracket_3.py.snap @@ -85,7 +85,7 @@ Module( 2 | # token starts a statement. 3 | 4 | [1, 2 - | ^ Syntax Error: Expected ']', found newline + | ^ Syntax Error: Expected `]`, found newline 5 | 6 | def foo(): 7 | pass diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__recover.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__recover.py.snap index 3b1ba32aac..3fa2a32578 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__recover.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__list__recover.py.snap @@ -305,7 +305,7 @@ Module( | 9 | # Missing comma 10 | [1 2] - | ^ Syntax Error: Expected ',', found int + | ^ Syntax Error: Expected `,`, found int 11 | 12 | # Dictionary element in a list | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_2.py.snap index 884fb234b2..057477b761 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__named__missing_expression_2.py.snap @@ -84,7 +84,7 @@ Module( 3 | (x := 4 | 5 | def foo(): - | ^^^ Syntax Error: Expected an identifier, but found a keyword 'def' that cannot be used here + | ^^^ Syntax Error: Expected an identifier, but found a keyword `def` that cannot be used here 6 | pass | @@ -93,7 +93,7 @@ Module( 3 | (x := 4 | 5 | def foo(): - | ^^^ Syntax Error: Expected ')', found name + | ^^^ Syntax Error: Expected `)`, found name 6 | pass | @@ -101,7 +101,7 @@ Module( | 5 | def foo(): 6 | pass - | ^^^^ Syntax Error: Expected an identifier, but found a keyword 'pass' that cannot be used here + | ^^^^ Syntax Error: Expected an identifier, but found a keyword `pass` that cannot be used here | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__generator.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__generator.py.snap index 3e8a85dc97..7ebe57ede2 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__generator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__generator.py.snap @@ -142,14 +142,14 @@ Module( | 1 | (*x for x in y) 2 | (x := 1, for x in y) - | ^^^ Syntax Error: Expected ')', found 'for' + | ^^^ Syntax Error: Expected `)`, found `for` | | 1 | (*x for x in y) 2 | (x := 1, for x in y) - | ^ Syntax Error: Expected ':', found ')' + | ^ Syntax Error: Expected `:`, found `)` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_3.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_3.py.snap index b98aae283e..24ae8dd4bb 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_3.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__missing_closing_paren_3.py.snap @@ -86,7 +86,7 @@ Module( 2 | # token starts a statement. 3 | 4 | (1, 2 - | ^ Syntax Error: Expected ')', found newline + | ^ Syntax Error: Expected `)`, found newline 5 | 6 | def foo(): 7 | pass diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple.py.snap index 768381c483..7670ed0edd 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple.py.snap @@ -315,7 +315,7 @@ Module( | 9 | # Missing comma 10 | (1 2) - | ^ Syntax Error: Expected ')', found int + | ^ Syntax Error: Expected `)`, found int 11 | 12 | # Dictionary element in a list | @@ -343,7 +343,7 @@ Module( | 12 | # Dictionary element in a list 13 | (1: 2) - | ^ Syntax Error: Expected ')', found ':' + | ^ Syntax Error: Expected `)`, found `:` 14 | 15 | # Missing expression | @@ -390,7 +390,7 @@ Module( 16 | (1, x + ) 17 | 18 | (1; 2) - | ^ Syntax Error: Expected ')', found ';' + | ^ Syntax Error: Expected `)`, found `;` 19 | 20 | # Unparenthesized named expression is not allowed | @@ -420,5 +420,5 @@ Module( | 20 | # Unparenthesized named expression is not allowed 21 | x, y := 2, z - | ^^ Syntax Error: Expected ',', found ':=' + | ^^ Syntax Error: Expected `,`, found `:=` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple_starred_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple_starred_expr.py.snap index da92fa1991..05cd9dbaca 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple_starred_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__parenthesized__tuple_starred_expr.py.snap @@ -1542,5 +1542,5 @@ Module( 18 | *x if True else y, z, *x if True else y 19 | *lambda x: x, z, *lambda x: x 20 | *x := 2, z, *x := 2 - | ^^ Syntax Error: Expected ',', found ':=' + | ^^ Syntax Error: Expected `,`, found `:=` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_3.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_3.py.snap index 311eaae530..0be8d06138 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_3.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__missing_closing_curly_brace_3.py.snap @@ -84,7 +84,7 @@ Module( 2 | # token starts a statement. 3 | 4 | {1, 2 - | ^ Syntax Error: Expected '}', found newline + | ^ Syntax Error: Expected `}`, found newline 5 | 6 | def foo(): 7 | pass diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__recover.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__recover.py.snap index b489b1c64f..74e95fe8c7 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__recover.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__set__recover.py.snap @@ -302,7 +302,7 @@ Module( | 11 | # Missing comma 12 | {1 2} - | ^ Syntax Error: Expected ',', found int + | ^ Syntax Error: Expected `,`, found int 13 | 14 | # Dictionary element in a list | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__unclosed_slice_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__unclosed_slice_1.py.snap index d3e57ddfc0..05de28c275 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__unclosed_slice_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__subscript__unclosed_slice_1.py.snap @@ -95,7 +95,7 @@ Module( 1 | x[:: 2 | 3 | def foo(): - | ^^^ Syntax Error: Expected an identifier, but found a keyword 'def' that cannot be used here + | ^^^ Syntax Error: Expected an identifier, but found a keyword `def` that cannot be used here 4 | pass | @@ -104,7 +104,7 @@ Module( 1 | x[:: 2 | 3 | def foo(): - | ^^^ Syntax Error: Expected ']', found name + | ^^^ Syntax Error: Expected `]`, found name 4 | pass | @@ -112,7 +112,7 @@ Module( | 3 | def foo(): 4 | pass - | ^^^^ Syntax Error: Expected an identifier, but found a keyword 'pass' that cannot be used here + | ^^^^ Syntax Error: Expected an identifier, but found a keyword `pass` that cannot be used here | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__named_expression.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__named_expression.py.snap index 5feebcc55f..49a4e5362b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__named_expression.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@expressions__yield__named_expression.py.snap @@ -125,5 +125,5 @@ Module( 2 | yield x := 1 3 | 4 | yield 1, x := 2, 3 - | ^^ Syntax Error: Expected ',', found ':=' + | ^^ Syntax Error: Expected `,`, found `:=` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_lambda_without_parentheses.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_lambda_without_parentheses.py.snap index b7da154352..2f5d767448 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_lambda_without_parentheses.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_lambda_without_parentheses.py.snap @@ -117,7 +117,7 @@ Module( | 1 | f"{lambda x: x}" - | ^^ Syntax Error: f-string: expecting '}' + | ^^ Syntax Error: f-string: expecting `}` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_unclosed_lbrace.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_unclosed_lbrace.py.snap index c8b75ce3f9..004ae87faa 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_unclosed_lbrace.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_unclosed_lbrace.py.snap @@ -267,7 +267,7 @@ Module( | 1 | f"{" 2 | f"{foo!r" - | ^ Syntax Error: f-string: expecting '}' + | ^ Syntax Error: f-string: expecting `}` 3 | f"{foo=" 4 | f"{" | @@ -277,7 +277,7 @@ Module( 1 | f"{" 2 | f"{foo!r" 3 | f"{foo=" - | ^ Syntax Error: f-string: expecting '}' + | ^ Syntax Error: f-string: expecting `}` 4 | f"{" 5 | f"""{""" | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_unclosed_lbrace_in_format_spec.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_unclosed_lbrace_in_format_spec.py.snap index cf843119c2..ac1d7c98f4 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_unclosed_lbrace_in_format_spec.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@f_string_unclosed_lbrace_in_format_spec.py.snap @@ -146,7 +146,7 @@ Module( | 1 | f"hello {x:" - | ^ Syntax Error: f-string: expecting '}' + | ^ Syntax Error: f-string: expecting `}` 2 | f"hello {x:.3f" | @@ -154,5 +154,5 @@ Module( | 1 | f"hello {x:" 2 | f"hello {x:.3f" - | ^ Syntax Error: f-string: expecting '}' + | ^ Syntax Error: f-string: expecting `}` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_iter_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_iter_expr.py.snap index 907c07e8ce..ab00df4afe 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_iter_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_iter_expr.py.snap @@ -192,7 +192,7 @@ Module( 1 | for x in *a and b: ... 2 | for x in yield a: ... 3 | for target in x := 1: ... - | ^^ Syntax Error: Expected ':', found ':=' + | ^^ Syntax Error: Expected `:`, found `:=` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_target.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_target.py.snap index 04caa94916..88050de12e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_invalid_target.py.snap @@ -498,7 +498,7 @@ Module( 4 | for *x | y in z: ... 5 | for await x in z: ... 6 | for yield x in y: ... - | ^ Syntax Error: Expected 'in', found ':' + | ^ Syntax Error: Expected `in`, found `:` 7 | for [x, 1, y, *["a"]] in z: ... | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_in_keyword.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_in_keyword.py.snap index 8052c314b5..a2bf0f699d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_in_keyword.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_in_keyword.py.snap @@ -94,7 +94,7 @@ Module( | 1 | for a b: ... - | ^ Syntax Error: Expected 'in', found name + | ^ Syntax Error: Expected `in`, found name 2 | for a: ... | @@ -102,5 +102,5 @@ Module( | 1 | for a b: ... 2 | for a: ... - | ^ Syntax Error: Expected 'in', found ':' + | ^ Syntax Error: Expected `in`, found `:` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_target.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_target.py.snap index 84d8b4f8cd..7742223cd0 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_target.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@for_stmt_missing_target.py.snap @@ -56,11 +56,11 @@ Module( | 1 | for in x: ... - | ^^ Syntax Error: Expected an identifier, but found a keyword 'in' that cannot be used here + | ^^ Syntax Error: Expected an identifier, but found a keyword `in` that cannot be used here | | 1 | for in x: ... - | ^ Syntax Error: Expected 'in', found name + | ^ Syntax Error: Expected `in`, found name | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_dotted_names.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_dotted_names.py.snap index 2520cfbe49..a0fbe287f6 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_dotted_names.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_dotted_names.py.snap @@ -166,7 +166,7 @@ Module( | 1 | from x import a. - | ^ Syntax Error: Expected ',', found '.' + | ^ Syntax Error: Expected `,`, found `.` 2 | from x import a.b 3 | from x import a, b.c, d, e.f, g | @@ -175,7 +175,7 @@ Module( | 1 | from x import a. 2 | from x import a.b - | ^ Syntax Error: Expected ',', found '.' + | ^ Syntax Error: Expected `,`, found `.` 3 | from x import a, b.c, d, e.f, g | @@ -184,7 +184,7 @@ Module( 1 | from x import a. 2 | from x import a.b 3 | from x import a, b.c, d, e.f, g - | ^ Syntax Error: Expected ',', found '.' + | ^ Syntax Error: Expected `,`, found `.` | @@ -192,5 +192,5 @@ Module( 1 | from x import a. 2 | from x import a.b 3 | from x import a, b.c, d, e.f, g - | ^ Syntax Error: Expected ',', found '.' + | ^ Syntax Error: Expected `,`, found `.` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_missing_rpar.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_missing_rpar.py.snap index f53eb5aeff..d1792e0e09 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_missing_rpar.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@from_import_missing_rpar.py.snap @@ -152,7 +152,7 @@ Module( | 1 | from x import (a, b - | ^ Syntax Error: Expected ')', found newline + | ^ Syntax Error: Expected `)`, found newline 2 | 1 + 1 3 | from x import (a, b, 4 | 2 + 2 @@ -163,6 +163,6 @@ Module( 1 | from x import (a, b 2 | 1 + 1 3 | from x import (a, b, - | ^ Syntax Error: Expected ')', found newline + | ^ Syntax Error: Expected `)`, found newline 4 | 2 + 2 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unclosed_parameter_list.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unclosed_parameter_list.py.snap index 9028296eeb..9efb6d3fac 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unclosed_parameter_list.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unclosed_parameter_list.py.snap @@ -234,7 +234,7 @@ Module( | 1 | def foo(a: int, b: - | ^ Syntax Error: Expected ')', found newline + | ^ Syntax Error: Expected `)`, found newline 2 | def foo(): 3 | return 42 4 | def foo(a: int, b: str @@ -254,7 +254,7 @@ Module( 3 | return 42 4 | def foo(a: int, b: str 5 | x = 10 - | ^ Syntax Error: Expected ',', found name + | ^ Syntax Error: Expected `,`, found name | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unclosed_type_param_list.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unclosed_type_param_list.py.snap index fa71509d1f..dd2412c32a 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unclosed_type_param_list.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@function_def_unclosed_type_param_list.py.snap @@ -163,7 +163,7 @@ Module( | 1 | def foo[T1, *T2(a, b): - | ^ Syntax Error: Expected ']', found '(' + | ^ Syntax Error: Expected `]`, found `(` 2 | return a + b 3 | x = 10 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_elif_missing_colon.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_elif_missing_colon.py.snap index d8ac7c86be..4238e23e7a 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_elif_missing_colon.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_elif_missing_colon.py.snap @@ -79,7 +79,7 @@ Module( 1 | if x: 2 | pass 3 | elif y - | ^ Syntax Error: Expected ':', found newline + | ^ Syntax Error: Expected `:`, found newline 4 | pass 5 | else: 6 | pass diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_missing_colon.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_missing_colon.py.snap index 8092bc7d7c..5dc30d6ce6 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_missing_colon.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@if_stmt_missing_colon.py.snap @@ -82,7 +82,7 @@ Module( | 1 | if x - | ^ Syntax Error: Expected ':', found newline + | ^ Syntax Error: Expected `:`, found newline 2 | if x 3 | pass 4 | a = 1 @@ -101,7 +101,7 @@ Module( | 1 | if x 2 | if x - | ^ Syntax Error: Expected ':', found newline + | ^ Syntax Error: Expected `:`, found newline 3 | pass 4 | a = 1 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_expected_colon.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_expected_colon.py.snap index f352512262..da778df7a1 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_expected_colon.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_expected_colon.py.snap @@ -80,6 +80,6 @@ Module( | 1 | match [1, 2] - | ^ Syntax Error: Expected ':', found newline + | ^ Syntax Error: Expected `:`, found newline 2 | case _: ... | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_no_newline_before_case.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_no_newline_before_case.py.snap index 324f3480ff..7888bcd48e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_no_newline_before_case.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@match_stmt_no_newline_before_case.py.snap @@ -61,7 +61,7 @@ Module( | 1 | match foo: case _: ... - | ^^^^ Syntax Error: Expected newline, found 'case' + | ^^^^ Syntax Error: Expected newline, found `case` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@multiple_clauses_on_same_line.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@multiple_clauses_on_same_line.py.snap index 0fb6c83f46..be571b2cd2 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@multiple_clauses_on_same_line.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@multiple_clauses_on_same_line.py.snap @@ -326,7 +326,7 @@ Module( | 1 | if True: pass elif False: pass else: pass - | ^^^^ Syntax Error: Expected newline, found 'elif' + | ^^^^ Syntax Error: Expected newline, found `elif` 2 | if True: pass; elif False: pass; else: pass 3 | for x in iter: break else: pass | @@ -334,7 +334,7 @@ Module( | 1 | if True: pass elif False: pass else: pass - | ^^^^ Syntax Error: Expected newline, found 'else' + | ^^^^ Syntax Error: Expected newline, found `else` 2 | if True: pass; elif False: pass; else: pass 3 | for x in iter: break else: pass | @@ -343,7 +343,7 @@ Module( | 1 | if True: pass elif False: pass else: pass 2 | if True: pass; elif False: pass; else: pass - | ^^^^ Syntax Error: Expected newline, found 'elif' + | ^^^^ Syntax Error: Expected newline, found `elif` 3 | for x in iter: break else: pass 4 | for x in iter: break; else: pass | @@ -352,7 +352,7 @@ Module( | 1 | if True: pass elif False: pass else: pass 2 | if True: pass; elif False: pass; else: pass - | ^^^^ Syntax Error: Expected newline, found 'else' + | ^^^^ Syntax Error: Expected newline, found `else` 3 | for x in iter: break else: pass 4 | for x in iter: break; else: pass | @@ -362,7 +362,7 @@ Module( 1 | if True: pass elif False: pass else: pass 2 | if True: pass; elif False: pass; else: pass 3 | for x in iter: break else: pass - | ^^^^ Syntax Error: Expected newline, found 'else' + | ^^^^ Syntax Error: Expected newline, found `else` 4 | for x in iter: break; else: pass 5 | try: pass except exc: pass else: pass finally: pass | @@ -372,7 +372,7 @@ Module( 2 | if True: pass; elif False: pass; else: pass 3 | for x in iter: break else: pass 4 | for x in iter: break; else: pass - | ^^^^ Syntax Error: Expected newline, found 'else' + | ^^^^ Syntax Error: Expected newline, found `else` 5 | try: pass except exc: pass else: pass finally: pass 6 | try: pass; except exc: pass; else: pass; finally: pass | @@ -382,7 +382,7 @@ Module( 3 | for x in iter: break else: pass 4 | for x in iter: break; else: pass 5 | try: pass except exc: pass else: pass finally: pass - | ^^^^^^ Syntax Error: Expected newline, found 'except' + | ^^^^^^ Syntax Error: Expected newline, found `except` 6 | try: pass; except exc: pass; else: pass; finally: pass | @@ -391,7 +391,7 @@ Module( 3 | for x in iter: break else: pass 4 | for x in iter: break; else: pass 5 | try: pass except exc: pass else: pass finally: pass - | ^^^^ Syntax Error: Expected newline, found 'else' + | ^^^^ Syntax Error: Expected newline, found `else` 6 | try: pass; except exc: pass; else: pass; finally: pass | @@ -400,7 +400,7 @@ Module( 3 | for x in iter: break else: pass 4 | for x in iter: break; else: pass 5 | try: pass except exc: pass else: pass finally: pass - | ^^^^^^^ Syntax Error: Expected newline, found 'finally' + | ^^^^^^^ Syntax Error: Expected newline, found `finally` 6 | try: pass; except exc: pass; else: pass; finally: pass | @@ -409,7 +409,7 @@ Module( 4 | for x in iter: break; else: pass 5 | try: pass except exc: pass else: pass finally: pass 6 | try: pass; except exc: pass; else: pass; finally: pass - | ^^^^^^ Syntax Error: Expected newline, found 'except' + | ^^^^^^ Syntax Error: Expected newline, found `except` | @@ -417,7 +417,7 @@ Module( 4 | for x in iter: break; else: pass 5 | try: pass except exc: pass else: pass finally: pass 6 | try: pass; except exc: pass; else: pass; finally: pass - | ^^^^ Syntax Error: Expected newline, found 'else' + | ^^^^ Syntax Error: Expected newline, found `else` | @@ -425,5 +425,5 @@ Module( 4 | for x in iter: break; else: pass 5 | try: pass except exc: pass else: pass finally: pass 6 | try: pass; except exc: pass; else: pass; finally: pass - | ^^^^^^^ Syntax Error: Expected newline, found 'finally' + | ^^^^^^^ Syntax Error: Expected newline, found `finally` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@named_expr_slice.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@named_expr_slice.py.snap index d521c935f4..ab0bcdf9ca 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@named_expr_slice.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@named_expr_slice.py.snap @@ -238,7 +238,7 @@ Module( 1 | # even after 3.9, an unparenthesized named expression is not allowed in a slice 2 | lst[x:=1:-1] 3 | lst[1:x:=1] - | ^^ Syntax Error: Expected ']', found ':=' + | ^^ Syntax Error: Expected `]`, found `:=` 4 | lst[1:3:x:=1] | @@ -265,7 +265,7 @@ Module( 2 | lst[x:=1:-1] 3 | lst[1:x:=1] 4 | lst[1:3:x:=1] - | ^^ Syntax Error: Expected ']', found ':=' + | ^^ Syntax Error: Expected `]`, found `:=` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@nested_quote_in_format_spec_py312.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@nested_quote_in_format_spec_py312.py.snap index c39b322387..7eec20f80b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@nested_quote_in_format_spec_py312.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@nested_quote_in_format_spec_py312.py.snap @@ -88,5 +88,5 @@ Module( | 1 | # parse_options: {"target-version": "3.12"} 2 | f"{1:""}" # this is a ParseError on all versions - | ^ Syntax Error: f-string: expecting '}' + | ^ Syntax Error: f-string: expecting `}` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@node_range_with_gaps.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@node_range_with_gaps.py.snap index c3a8cdca25..361fe1288b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@node_range_with_gaps.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@node_range_with_gaps.py.snap @@ -106,7 +106,7 @@ Module( | 1 | def foo # comment - | ^ Syntax Error: Expected '(', found newline + | ^ Syntax Error: Expected `(`, found newline 2 | def bar(): ... 3 | def baz | @@ -115,7 +115,7 @@ Module( | 1 | def foo # comment 2 | def bar(): ... - | ^^^ Syntax Error: Expected ')', found 'def' + | ^^^ Syntax Error: Expected `)`, found `def` 3 | def baz | @@ -124,12 +124,12 @@ Module( 1 | def foo # comment 2 | def bar(): ... 3 | def baz - | ^ Syntax Error: Expected '(', found newline + | ^ Syntax Error: Expected `(`, found newline | | 2 | def bar(): ... 3 | def baz - | ^ Syntax Error: Expected ')', found end of file + | ^ Syntax Error: Expected `)`, found end of file | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_with_invalid_annotation.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_with_invalid_annotation.py.snap index 149cc7b4ce..d6b1a5944e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_with_invalid_annotation.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@param_with_invalid_annotation.py.snap @@ -255,7 +255,7 @@ Module( 1 | def foo(arg: *int): ... 2 | def foo(arg: yield int): ... 3 | def foo(arg: x := int): ... - | ^^ Syntax Error: Expected ',', found ':=' + | ^^ Syntax Error: Expected `,`, found `:=` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_expected_after_star_separator.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_expected_after_star_separator.py.snap index b1d8bdaa92..f343b562c6 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_expected_after_star_separator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_expected_after_star_separator.py.snap @@ -251,7 +251,7 @@ Module( | 1 | def foo(*): ... - | ^ Syntax Error: Expected one or more keyword parameter after '*' separator + | ^ Syntax Error: Expected one or more keyword parameter after `*` separator 2 | def foo(*,): ... 3 | def foo(a, *): ... | @@ -260,7 +260,7 @@ Module( | 1 | def foo(*): ... 2 | def foo(*,): ... - | ^ Syntax Error: Expected one or more keyword parameter after '*' separator + | ^ Syntax Error: Expected one or more keyword parameter after `*` separator 3 | def foo(a, *): ... 4 | def foo(a, *,): ... | @@ -270,7 +270,7 @@ Module( 1 | def foo(*): ... 2 | def foo(*,): ... 3 | def foo(a, *): ... - | ^ Syntax Error: Expected one or more keyword parameter after '*' separator + | ^ Syntax Error: Expected one or more keyword parameter after `*` separator 4 | def foo(a, *,): ... 5 | def foo(*, **kwargs): ... | @@ -280,7 +280,7 @@ Module( 2 | def foo(*,): ... 3 | def foo(a, *): ... 4 | def foo(a, *,): ... - | ^ Syntax Error: Expected one or more keyword parameter after '*' separator + | ^ Syntax Error: Expected one or more keyword parameter after `*` separator 5 | def foo(*, **kwargs): ... | @@ -289,5 +289,5 @@ Module( 3 | def foo(a, *): ... 4 | def foo(a, *,): ... 5 | def foo(*, **kwargs): ... - | ^^^^^^^^ Syntax Error: Expected one or more keyword parameter after '*' separator + | ^^^^^^^^ Syntax Error: Expected one or more keyword parameter after `*` separator | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_kwarg_after_star_separator.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_kwarg_after_star_separator.py.snap index 324b7246ea..589d8905af 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_kwarg_after_star_separator.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_kwarg_after_star_separator.py.snap @@ -67,5 +67,5 @@ Module( | 1 | def foo(*, **kwargs): ... - | ^^^^^^^^ Syntax Error: Expected one or more keyword parameter after '*' separator + | ^^^^^^^^ Syntax Error: Expected one or more keyword parameter after `*` separator | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_var_keyword_with_default.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_var_keyword_with_default.py.snap index 3a8644b3a8..87adc006a3 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_var_keyword_with_default.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_var_keyword_with_default.py.snap @@ -165,19 +165,19 @@ Module( | 1 | def foo(a, **kwargs={'b': 1, 'c': 2}): ... - | ^ Syntax Error: Parameter with '*' or '**' cannot have default value + | ^ Syntax Error: Parameter with `*` or `**` cannot have default value | | 1 | def foo(a, **kwargs={'b': 1, 'c': 2}): ... - | ^ Syntax Error: Expected ')', found '{' + | ^ Syntax Error: Expected `)`, found `{` | | 1 | def foo(a, **kwargs={'b': 1, 'c': 2}): ... - | ^ Syntax Error: Expected newline, found ')' + | ^ Syntax Error: Expected newline, found `)` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_var_positional_with_default.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_var_positional_with_default.py.snap index 1e84abfa40..e965d4a0b4 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_var_positional_with_default.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@params_var_positional_with_default.py.snap @@ -117,19 +117,19 @@ Module( | 1 | def foo(a, *args=(1, 2)): ... - | ^ Syntax Error: Parameter with '*' or '**' cannot have default value + | ^ Syntax Error: Parameter with `*` or `**` cannot have default value | | 1 | def foo(a, *args=(1, 2)): ... - | ^ Syntax Error: Expected ')', found '(' + | ^ Syntax Error: Expected `)`, found `(` | | 1 | def foo(a, *args=(1, 2)): ... - | ^ Syntax Error: Expected newline, found ')' + | ^ Syntax Error: Expected newline, found `)` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@pos_only_py37.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@pos_only_py37.py.snap index f6650bb5d9..5328fcf7dd 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@pos_only_py37.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@pos_only_py37.py.snap @@ -298,7 +298,7 @@ Module( 3 | def foo(a, /, b, /): ... 4 | def foo(a, *args, /, b): ... 5 | def foo(a, //): ... - | ^^ Syntax Error: Expected ',', found '//' + | ^^ Syntax Error: Expected `,`, found `//` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token.py.snap index 45a5b27c78..61f3230855 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token.py.snap @@ -785,7 +785,7 @@ Module( | 1 | # No indentation before the function definition 2 | if call(foo - | ^ Syntax Error: Expected ')', found newline + | ^ Syntax Error: Expected `)`, found newline 3 | def bar(): 4 | pass | @@ -803,7 +803,7 @@ Module( | 7 | # Indented function definition 8 | if call(foo - | ^ Syntax Error: Expected ')', found newline + | ^ Syntax Error: Expected `)`, found newline 9 | def bar(): 10 | pass | @@ -812,7 +812,7 @@ Module( | 13 | # There are multiple non-logical newlines (blank lines) in the `if` body 14 | if call(foo - | ^ Syntax Error: Expected ')', found newline + | ^ Syntax Error: Expected `)`, found newline 15 | 16 | 17 | def bar(): @@ -822,7 +822,7 @@ Module( | 21 | # There are trailing whitespaces in the blank line inside the `if` body 22 | if call(foo - | ^ Syntax Error: Expected ')', found newline + | ^ Syntax Error: Expected `)`, found newline 23 | 24 | def bar(): 25 | pass @@ -832,7 +832,7 @@ Module( | 28 | # The lexer is nested with multiple levels of parentheses 29 | if call(foo, [a, b - | ^ Syntax Error: Expected ']', found NonLogicalNewline + | ^ Syntax Error: Expected `]`, found NonLogicalNewline 30 | def bar(): 31 | pass | @@ -841,7 +841,7 @@ Module( | 34 | # The outer parenthesis is closed but the inner bracket isn't 35 | if call(foo, [a, b) - | ^ Syntax Error: Expected ']', found ')' + | ^ Syntax Error: Expected `]`, found `)` 36 | def bar(): 37 | pass | @@ -850,7 +850,7 @@ Module( | 34 | # The outer parenthesis is closed but the inner bracket isn't 35 | if call(foo, [a, b) - | ^ Syntax Error: Expected ':', found newline + | ^ Syntax Error: Expected `:`, found newline 36 | def bar(): 37 | pass | @@ -860,7 +860,7 @@ Module( 41 | # test is to make sure it emits a `NonLogicalNewline` token after `b`. 42 | if call(foo, [a, 43 | b - | ^ Syntax Error: Expected ']', found NonLogicalNewline + | ^ Syntax Error: Expected `]`, found NonLogicalNewline 44 | ) 45 | def bar(): 46 | pass @@ -871,7 +871,7 @@ Module( 42 | if call(foo, [a, 43 | b 44 | ) - | ^ Syntax Error: Expected ':', found newline + | ^ Syntax Error: Expected `:`, found newline 45 | def bar(): 46 | pass | @@ -890,7 +890,7 @@ Module( 49 | # F-strings uses normal list parsing, so test those as well 50 | if call(f"hello {x 51 | def bar(): - | ^^^ Syntax Error: f-string: expecting '}' + | ^^^ Syntax Error: f-string: expecting `}` 52 | pass | @@ -923,7 +923,7 @@ Module( | 55 | if call(f"hello 56 | def bar(): - | ^^^^ Syntax Error: Expected ',', found indent + | ^^^^ Syntax Error: Expected `,`, found indent 57 | pass | @@ -931,7 +931,7 @@ Module( | 55 | if call(f"hello 56 | def bar(): - | ^^^ Syntax Error: Expected ')', found 'def' + | ^^^ Syntax Error: Expected `)`, found `def` 57 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_mac_eol.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_mac_eol.py.snap index d9082066b8..5567459c70 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_mac_eol.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_mac_eol.py.snap @@ -113,5 +113,5 @@ Module( | 1 | if call(foo, [a, b def bar(): pass - | ^ Syntax Error: Expected ']', found NonLogicalNewline + | ^ Syntax Error: Expected `]`, found NonLogicalNewline | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_windows_eol.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_windows_eol.py.snap index c3b23f4fbd..ae03fee095 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_windows_eol.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lex_logical_token_windows_eol.py.snap @@ -113,7 +113,7 @@ Module( | 1 | if call(foo, [a, b - | ^ Syntax Error: Expected ']', found NonLogicalNewline + | ^ Syntax Error: Expected `]`, found NonLogicalNewline 2 | def bar(): 3 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__fstring_format_spec_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__fstring_format_spec_1.py.snap index 1e2ad65fcf..d836318aea 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__fstring_format_spec_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__fstring_format_spec_1.py.snap @@ -399,7 +399,7 @@ Module( | 5 | f'middle {'string':\ 6 | 'format spec'} - | ^ Syntax Error: f-string: expecting '}' + | ^ Syntax Error: f-string: expecting `}` 7 | 8 | f'middle {'string':\\ | @@ -445,7 +445,7 @@ Module( 6 | 'format spec'} 7 | 8 | f'middle {'string':\\ - | ^ Syntax Error: f-string: expecting '}' + | ^ Syntax Error: f-string: expecting `}` 9 | 'format spec'} 10 | 11 | f'middle {'string':\\\ @@ -492,7 +492,7 @@ Module( | 11 | f'middle {'string':\\\ 12 | 'format spec'} - | ^ Syntax Error: f-string: expecting '}' + | ^ Syntax Error: f-string: expecting `}` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_1.py.snap index 54c66a5216..21f4465c4e 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_1.py.snap @@ -110,7 +110,7 @@ Module( | 1 | call(a, b, \\\ 2 | - | ^ Syntax Error: Expected ')', found newline + | ^ Syntax Error: Expected `)`, found newline 3 | def bar(): 4 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_windows_eol.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_windows_eol.py.snap index f1ae6a18c9..cde70bca42 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_windows_eol.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__line_continuation_windows_eol.py.snap @@ -93,7 +93,7 @@ Module( | 1 | call(a, b, # comment \ - | ^ Syntax Error: Expected ')', found newline + | ^ Syntax Error: Expected `)`, found newline 2 | 3 | def bar(): 4 | pass diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_1.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_1.py.snap index 1a9af6dacc..f58010350b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_1.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_1.py.snap @@ -83,7 +83,7 @@ Module( | 5 | f"""hello {x # comment 6 | y = 1 - | ^ Syntax Error: f-string: expecting '}' + | ^ Syntax Error: f-string: expecting `}` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_2.py.snap index 50bb114c7e..7a5f85ab4a 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_2.py.snap @@ -80,5 +80,5 @@ Module( | 5 | f'''{foo:.3f 6 | ''' - | ^^^ Syntax Error: f-string: expecting '}' + | ^^^ Syntax Error: f-string: expecting `}` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_3.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_3.py.snap index 174ebceee4..3c611d4fbe 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_3.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@re_lexing__triple_quoted_fstring_3.py.snap @@ -110,7 +110,7 @@ Module( | 5 | if call(f'''{x:.3f 6 | ''' - | ^^^ Syntax Error: f-string: expecting '}' + | ^^^ Syntax Error: f-string: expecting `}` 7 | pass | @@ -118,6 +118,6 @@ Module( | 5 | if call(f'''{x:.3f 6 | ''' - | ^ Syntax Error: Expected ')', found newline + | ^ Syntax Error: Expected `)`, found newline 7 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__function_type_parameters.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__function_type_parameters.py.snap index 9618f4200b..18b90424fa 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__function_type_parameters.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__function_type_parameters.py.snap @@ -375,7 +375,7 @@ Module( 9 | # on following lines. 10 | 11 | def keyword[A, await](): ... - | ^^^^^ Syntax Error: Expected an identifier, but found a keyword 'await' that cannot be used here + | ^^^^^ Syntax Error: Expected an identifier, but found a keyword `await` that cannot be used here 12 | 13 | def not_a_type_param[A, |, B](): ... | @@ -385,7 +385,7 @@ Module( 11 | def keyword[A, await](): ... 12 | 13 | def not_a_type_param[A, |, B](): ... - | ^ Syntax Error: Expected ',', found '|' + | ^ Syntax Error: Expected `,`, found `|` 14 | 15 | def multiple_commas[A,,B](): ... | @@ -433,7 +433,7 @@ Module( 17 | def multiple_trailing_commas[A,,](): ... 18 | 19 | def multiple_commas_and_recovery[A,,100](): ... - | ^^^ Syntax Error: Expected ']', found int + | ^^^ Syntax Error: Expected `]`, found int | @@ -441,7 +441,7 @@ Module( 17 | def multiple_trailing_commas[A,,](): ... 18 | 19 | def multiple_commas_and_recovery[A,,100](): ... - | ^ Syntax Error: Expected newline, found ']' + | ^ Syntax Error: Expected newline, found `]` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__if_extra_closing_parentheses.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__if_extra_closing_parentheses.py.snap index 886c21590c..780f943a96 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__if_extra_closing_parentheses.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__if_extra_closing_parentheses.py.snap @@ -40,7 +40,7 @@ Module( | 1 | # FIXME(micha): This creates two syntax errors instead of just one (and overlapping ones) 2 | if True)): - | ^ Syntax Error: Expected ':', found ')' + | ^ Syntax Error: Expected `:`, found `)` 3 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_2.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_2.py.snap index 34e3500f26..4bd787208c 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_2.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_2.py.snap @@ -111,7 +111,7 @@ Module( 2 | # This `as` pattern is unparenthesied so the parser never takes the path 3 | # where it might be confused as a complex literal pattern. 4 | case x as y + 1j: - | ^ Syntax Error: Expected ':', found '+' + | ^ Syntax Error: Expected `:`, found `+` 5 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_3.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_3.py.snap index 07cd1a64e6..ad4dbb0ec8 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_3.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_3.py.snap @@ -113,7 +113,7 @@ Module( 2 | # Not in the mapping start token set, so the list parsing bails 3 | # v 4 | case {(x as y): 1}: - | ^ Syntax Error: Expected '}', found '(' + | ^ Syntax Error: Expected `}`, found `(` 5 | pass | @@ -131,7 +131,7 @@ Module( 2 | # Not in the mapping start token set, so the list parsing bails 3 | # v 4 | case {(x as y): 1}: - | ^ Syntax Error: Expected newline, found '}' + | ^ Syntax Error: Expected newline, found `}` 5 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_4.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_4.py.snap index 771706eaed..fde6679f01 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_4.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__as_pattern_4.py.snap @@ -114,7 +114,7 @@ Module( 2 | # This `as` pattern is unparenthesized so the parser never takes the path 3 | # where it might be confused as a mapping key pattern. 4 | case {x as y: 1}: - | ^^ Syntax Error: Expected ':', found 'as' + | ^^ Syntax Error: Expected `:`, found `as` 5 | pass | @@ -123,6 +123,6 @@ Module( 2 | # This `as` pattern is unparenthesized so the parser never takes the path 3 | # where it might be confused as a mapping key pattern. 4 | case {x as y: 1}: - | ^ Syntax Error: Expected ',', found name + | ^ Syntax Error: Expected `,`, found name 5 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__invalid_mapping_pattern.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__invalid_mapping_pattern.py.snap index 5592524488..1fbaa9df86 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__invalid_mapping_pattern.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__invalid_mapping_pattern.py.snap @@ -540,7 +540,7 @@ Module( 1 | # Starred expression is not allowed as a mapping pattern key 2 | match subject: 3 | case {*key}: - | ^ Syntax Error: Expected ':', found '}' + | ^ Syntax Error: Expected `:`, found `}` 4 | pass 5 | case {*key: 1}: | @@ -570,7 +570,7 @@ Module( 5 | case {*key: 1}: 6 | pass 7 | case {*key 1}: - | ^ Syntax Error: Expected ':', found int + | ^ Syntax Error: Expected `:`, found int 8 | pass 9 | case {*key, None: 1}: | @@ -589,7 +589,7 @@ Module( 7 | case {*key 1}: 8 | pass 9 | case {*key, None: 1}: - | ^ Syntax Error: Expected ':', found ',' + | ^ Syntax Error: Expected `:`, found `,` 10 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__star_pattern_usage.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__star_pattern_usage.py.snap index 364d382ff2..d87687110b 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__star_pattern_usage.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__match__star_pattern_usage.py.snap @@ -580,7 +580,7 @@ Module( 15 | case Foo(x=*_): 16 | pass 17 | case {*_}: - | ^ Syntax Error: Expected ':', found '}' + | ^ Syntax Error: Expected `:`, found `}` 18 | pass 19 | case {*_: 1}: | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__ambiguous_lpar_with_items.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__ambiguous_lpar_with_items.py.snap index 9d872e920e..61ff19b25d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__ambiguous_lpar_with_items.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__ambiguous_lpar_with_items.py.snap @@ -1580,7 +1580,7 @@ Module( | 4 | with (item1, item2),: ... 5 | with (item1, item2), as f: ... - | ^^ Syntax Error: Expected ',', found 'as' + | ^^ Syntax Error: Expected `,`, found `as` 6 | with (item1, item2), item3,: ... 7 | with (*item): ... | @@ -1640,7 +1640,7 @@ Module( 9 | with (item := 10 as f): ... 10 | with (item1, item2 := 10 as f): ... 11 | with (x for x in range(10), item): ... - | ^ Syntax Error: Expected ')', found ',' + | ^ Syntax Error: Expected `)`, found `,` 12 | with (item, x for x in range(10)): ... | @@ -1649,7 +1649,7 @@ Module( 9 | with (item := 10 as f): ... 10 | with (item1, item2 := 10 as f): ... 11 | with (x for x in range(10), item): ... - | ^ Syntax Error: Expected ',', found ')' + | ^ Syntax Error: Expected `,`, found `)` 12 | with (item, x for x in range(10)): ... | @@ -1658,7 +1658,7 @@ Module( 10 | with (item1, item2 := 10 as f): ... 11 | with (x for x in range(10), item): ... 12 | with (item, x for x in range(10)): ... - | ^^^ Syntax Error: Expected ')', found 'for' + | ^^^ Syntax Error: Expected `)`, found `for` 13 | 14 | # Make sure the parser doesn't report the same error twice | @@ -1668,7 +1668,7 @@ Module( 10 | with (item1, item2 := 10 as f): ... 11 | with (x for x in range(10), item): ... 12 | with (item, x for x in range(10)): ... - | ^ Syntax Error: Expected ':', found ')' + | ^ Syntax Error: Expected `:`, found `)` 13 | 14 | # Make sure the parser doesn't report the same error twice | @@ -1707,7 +1707,7 @@ Module( 15 | with ((*item)): ... 16 | 17 | with (*x for x in iter, item): ... - | ^ Syntax Error: Expected ')', found ',' + | ^ Syntax Error: Expected `)`, found `,` 18 | with (item1, *x for x in iter, item2): ... 19 | with (x as f, *y): ... | @@ -1717,7 +1717,7 @@ Module( 15 | with ((*item)): ... 16 | 17 | with (*x for x in iter, item): ... - | ^ Syntax Error: Expected ',', found ')' + | ^ Syntax Error: Expected `,`, found `)` 18 | with (item1, *x for x in iter, item2): ... 19 | with (x as f, *y): ... | @@ -1726,7 +1726,7 @@ Module( | 17 | with (*x for x in iter, item): ... 18 | with (item1, *x for x in iter, item2): ... - | ^^^ Syntax Error: Expected ')', found 'for' + | ^^^ Syntax Error: Expected `)`, found `for` 19 | with (x as f, *y): ... 20 | with (*x, y as f): ... | @@ -1735,7 +1735,7 @@ Module( | 17 | with (*x for x in iter, item): ... 18 | with (item1, *x for x in iter, item2): ... - | ^ Syntax Error: Expected ':', found ')' + | ^ Syntax Error: Expected `:`, found `)` 19 | with (x as f, *y): ... 20 | with (*x, y as f): ... | @@ -1804,7 +1804,7 @@ Module( 22 | with (x, yield y, z): ... 23 | with (x, yield from y): ... 24 | with (x as f, y) as f: ... - | ^^ Syntax Error: Expected ':', found 'as' + | ^^ Syntax Error: Expected `:`, found `as` 25 | with (x for x in iter as y): ... | @@ -1813,7 +1813,7 @@ Module( 23 | with (x, yield from y): ... 24 | with (x as f, y) as f: ... 25 | with (x for x in iter as y): ... - | ^^ Syntax Error: Expected ')', found 'as' + | ^^ Syntax Error: Expected `)`, found `as` 26 | 27 | # The inner `(...)` is parsed as parenthesized expression | @@ -1823,7 +1823,7 @@ Module( 23 | with (x, yield from y): ... 24 | with (x as f, y) as f: ... 25 | with (x for x in iter as y): ... - | ^ Syntax Error: Expected ',', found ')' + | ^ Syntax Error: Expected `,`, found `)` 26 | 27 | # The inner `(...)` is parsed as parenthesized expression | @@ -1832,7 +1832,7 @@ Module( | 27 | # The inner `(...)` is parsed as parenthesized expression 28 | with ((item as f)): ... - | ^^ Syntax Error: Expected ')', found 'as' + | ^^ Syntax Error: Expected `)`, found `as` 29 | 30 | with (item as f), x: ... | @@ -1841,7 +1841,7 @@ Module( | 27 | # The inner `(...)` is parsed as parenthesized expression 28 | with ((item as f)): ... - | ^ Syntax Error: Expected ':', found ')' + | ^ Syntax Error: Expected `:`, found `)` 29 | 30 | with (item as f), x: ... | @@ -1860,7 +1860,7 @@ Module( 28 | with ((item as f)): ... 29 | 30 | with (item as f), x: ... - | ^ Syntax Error: Expected ':', found ',' + | ^ Syntax Error: Expected `:`, found `,` 31 | with (item as f1) as f2: ... 32 | with (item1 as f, item2 := 0): ... | @@ -1869,7 +1869,7 @@ Module( | 30 | with (item as f), x: ... 31 | with (item as f1) as f2: ... - | ^^ Syntax Error: Expected ':', found 'as' + | ^^ Syntax Error: Expected `:`, found `as` 32 | with (item1 as f, item2 := 0): ... | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unparenthesized_with_items.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unparenthesized_with_items.py.snap index 7e2d808bc6..daebbd0a96 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unparenthesized_with_items.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@statements__with__unparenthesized_with_items.py.snap @@ -401,5 +401,5 @@ Module( 7 | with *item1, item2 as f: pass 8 | with item1 as f, *item2: pass 9 | with item := 0 as f: pass - | ^^ Syntax Error: Expected ',', found ':=' + | ^^ Syntax Error: Expected `,`, found `:=` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@t_string_lambda_without_parentheses.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@t_string_lambda_without_parentheses.py.snap index 0d23f0c0d2..0de7376e01 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@t_string_lambda_without_parentheses.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@t_string_lambda_without_parentheses.py.snap @@ -118,7 +118,7 @@ Module( | 1 | # parse_options: {"target-version": "3.14"} 2 | t"{lambda x: x}" - | ^^ Syntax Error: t-string: expecting '}' + | ^^ Syntax Error: t-string: expecting `}` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@t_string_unclosed_lbrace.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@t_string_unclosed_lbrace.py.snap index 4ff0a7d78f..f39f719d1d 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@t_string_unclosed_lbrace.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@t_string_unclosed_lbrace.py.snap @@ -259,7 +259,7 @@ Module( 1 | # parse_options: {"target-version": "3.14"} 2 | t"{" 3 | t"{foo!r" - | ^ Syntax Error: t-string: expecting '}' + | ^ Syntax Error: t-string: expecting `}` 4 | t"{foo=" 5 | t"{" | @@ -269,7 +269,7 @@ Module( 2 | t"{" 3 | t"{foo!r" 4 | t"{foo=" - | ^ Syntax Error: t-string: expecting '}' + | ^ Syntax Error: t-string: expecting `}` 5 | t"{" 6 | t"""{""" | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@t_string_unclosed_lbrace_in_format_spec.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@t_string_unclosed_lbrace_in_format_spec.py.snap index bc20f6172c..9789ed8922 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@t_string_unclosed_lbrace_in_format_spec.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@t_string_unclosed_lbrace_in_format_spec.py.snap @@ -143,7 +143,7 @@ Module( | 1 | # parse_options: {"target-version": "3.14"} 2 | t"hello {x:" - | ^ Syntax Error: t-string: expecting '}' + | ^ Syntax Error: t-string: expecting `}` 3 | t"hello {x:.3f" | @@ -152,5 +152,5 @@ Module( 1 | # parse_options: {"target-version": "3.14"} 2 | t"hello {x:" 3 | t"hello {x:.3f" - | ^ Syntax Error: t-string: expecting '}' + | ^ Syntax Error: t-string: expecting `}` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_invalid_bound_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_invalid_bound_expr.py.snap index 321704cd05..7876c6b6ec 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_invalid_bound_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_invalid_bound_expr.py.snap @@ -288,7 +288,7 @@ Module( 2 | type X[T: yield x] = int 3 | type X[T: yield from x] = int 4 | type X[T: x := int] = int - | ^^ Syntax Error: Expected ',', found ':=' + | ^^ Syntax Error: Expected `,`, found `:=` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_bound.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_bound.py.snap index de9da4848d..351a141b60 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_bound.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_bound.py.snap @@ -88,7 +88,7 @@ Module( | 1 | type X[**T: int] = int - | ^ Syntax Error: Expected ']', found ':' + | ^ Syntax Error: Expected `]`, found `:` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_invalid_default_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_invalid_default_expr.py.snap index dad7c709de..0bcbd3cc52 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_invalid_default_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_param_spec_invalid_default_expr.py.snap @@ -343,7 +343,7 @@ Module( 2 | type X[**P = yield x] = int 3 | type X[**P = yield from x] = int 4 | type X[**P = x := int] = int - | ^^ Syntax Error: Expected ',', found ':=' + | ^^ Syntax Error: Expected `,`, found `:=` 5 | type X[**P = *int] = int | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_invalid_default_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_invalid_default_expr.py.snap index 2831009c20..c3e38b8e9a 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_invalid_default_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_invalid_default_expr.py.snap @@ -417,7 +417,7 @@ Module( 3 | type X[T = (yield x)] = int 4 | type X[T = yield from x] = int 5 | type X[T = x := int] = int - | ^^ Syntax Error: Expected ',', found ':=' + | ^^ Syntax Error: Expected `,`, found `:=` 6 | type X[T: int = *int] = int | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_bound.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_bound.py.snap index e1693e1722..ae228c0e30 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_bound.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_bound.py.snap @@ -88,7 +88,7 @@ Module( | 1 | type X[*T: int] = int - | ^ Syntax Error: Expected ']', found ':' + | ^ Syntax Error: Expected `]`, found `:` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_invalid_default_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_invalid_default_expr.py.snap index 9b2d1c6de9..4aff137a73 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_invalid_default_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@type_param_type_var_tuple_invalid_default_expr.py.snap @@ -361,7 +361,7 @@ Module( 3 | type X[*Ts = yield x] = int 4 | type X[*Ts = yield from x] = int 5 | type X[*Ts = x := int] = int - | ^^ Syntax Error: Expected ',', found ':=' + | ^^ Syntax Error: Expected `,`, found `:=` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@unterminated_fstring_newline_recovery.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@unterminated_fstring_newline_recovery.py.snap index 0595f124f2..7ed7f32534 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@unterminated_fstring_newline_recovery.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@unterminated_fstring_newline_recovery.py.snap @@ -376,7 +376,7 @@ Module( 2 | 1 + 1 3 | f"hello {x 4 | 2 + 2 - | ^ Syntax Error: f-string: expecting '}' + | ^ Syntax Error: f-string: expecting `}` 5 | f"hello {x: 6 | 3 + 3 | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_invalid_test_expr.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_invalid_test_expr.py.snap index 0af23c288c..acdd7532ad 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_invalid_test_expr.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_invalid_test_expr.py.snap @@ -201,7 +201,7 @@ Module( 1 | while *x: ... 2 | while yield x: ... 3 | while a, b: ... - | ^ Syntax Error: Expected ':', found ',' + | ^ Syntax Error: Expected `:`, found `,` 4 | while a := 1, b: ... | @@ -210,5 +210,5 @@ Module( 2 | while yield x: ... 3 | while a, b: ... 4 | while a := 1, b: ... - | ^ Syntax Error: Expected ':', found ',' + | ^ Syntax Error: Expected `:`, found `,` | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_missing_colon.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_missing_colon.py.snap index 67fb75a824..9ad6e62132 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_missing_colon.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@while_stmt_missing_colon.py.snap @@ -63,6 +63,6 @@ Module( 1 | while ( 2 | a < 30 # comment 3 | ) - | ^ Syntax Error: Expected ':', found newline + | ^ Syntax Error: Expected `:`, found newline 4 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@with_items_parenthesized_missing_colon.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@with_items_parenthesized_missing_colon.py.snap index 668c7c2c08..817368aa22 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@with_items_parenthesized_missing_colon.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@with_items_parenthesized_missing_colon.py.snap @@ -62,6 +62,6 @@ Module( | 1 | # `)` followed by a newline 2 | with (item1, item2) - | ^ Syntax Error: Expected ':', found newline + | ^ Syntax Error: Expected `:`, found newline 3 | pass | diff --git a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@with_items_parenthesized_missing_comma.py.snap b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@with_items_parenthesized_missing_comma.py.snap index ea060453a9..0c4b117dcf 100644 --- a/crates/ruff_python_parser/tests/snapshots/invalid_syntax@with_items_parenthesized_missing_comma.py.snap +++ b/crates/ruff_python_parser/tests/snapshots/invalid_syntax@with_items_parenthesized_missing_comma.py.snap @@ -338,7 +338,7 @@ Module( | 1 | with (item1 item2): ... - | ^^^^^ Syntax Error: Expected ',', found name + | ^^^^^ Syntax Error: Expected `,`, found name 2 | with (item1 as f1 item2): ... 3 | with (item1, item2 item3, item4): ... | @@ -347,7 +347,7 @@ Module( | 1 | with (item1 item2): ... 2 | with (item1 as f1 item2): ... - | ^^^^^ Syntax Error: Expected ',', found name + | ^^^^^ Syntax Error: Expected `,`, found name 3 | with (item1, item2 item3, item4): ... 4 | with (item1, item2 as f1 item3, item4): ... | @@ -357,7 +357,7 @@ Module( 1 | with (item1 item2): ... 2 | with (item1 as f1 item2): ... 3 | with (item1, item2 item3, item4): ... - | ^^^^^ Syntax Error: Expected ',', found name + | ^^^^^ Syntax Error: Expected `,`, found name 4 | with (item1, item2 as f1 item3, item4): ... 5 | with (item1, item2: ... | @@ -367,7 +367,7 @@ Module( 2 | with (item1 as f1 item2): ... 3 | with (item1, item2 item3, item4): ... 4 | with (item1, item2 as f1 item3, item4): ... - | ^^^^^ Syntax Error: Expected ',', found name + | ^^^^^ Syntax Error: Expected `,`, found name 5 | with (item1, item2: ... | @@ -376,5 +376,5 @@ Module( 3 | with (item1, item2 item3, item4): ... 4 | with (item1, item2 as f1 item3, item4): ... 5 | with (item1, item2: ... - | ^ Syntax Error: Expected ')', found ':' + | ^ Syntax Error: Expected `)`, found `:` | diff --git a/crates/ty_python_semantic/resources/mdtest/comprehensions/invalid_syntax.md b/crates/ty_python_semantic/resources/mdtest/comprehensions/invalid_syntax.md index f16ec0505d..fd2a6ef0cf 100644 --- a/crates/ty_python_semantic/resources/mdtest/comprehensions/invalid_syntax.md +++ b/crates/ty_python_semantic/resources/mdtest/comprehensions/invalid_syntax.md @@ -1,20 +1,20 @@ # Comprehensions with invalid syntax ```py -# Missing 'in' keyword. +# Missing `in` keyword. # It's reasonably clear here what they *meant* to write, # so we'll still infer the correct type: -# error: [invalid-syntax] "Expected 'in', found name" +# error: [invalid-syntax] "Expected `in`, found name" # revealed: int [reveal_type(a) for a range(3)] # Missing iteration variable -# error: [invalid-syntax] "Expected an identifier, but found a keyword 'in' that cannot be used here" -# error: [invalid-syntax] "Expected 'in', found name" +# error: [invalid-syntax] "Expected an identifier, but found a keyword `in` that cannot be used here" +# error: [invalid-syntax] "Expected `in`, found name" # error: [unresolved-reference] # revealed: Unknown [reveal_type(b) for in range(3)] @@ -27,9 +27,9 @@ [reveal_type(c) for c in] -# Missing 'in' keyword and missing iterable +# Missing `in` keyword and missing iterable -# error: [invalid-syntax] "Expected 'in', found ']'" +# error: [invalid-syntax] "Expected `in`, found `]`" # revealed: Unknown [reveal_type(d) for d] ``` diff --git a/crates/ty_python_semantic/resources/mdtest/import/invalid_syntax.md b/crates/ty_python_semantic/resources/mdtest/import/invalid_syntax.md index 6b7423f86d..3b8ef67e72 100644 --- a/crates/ty_python_semantic/resources/mdtest/import/invalid_syntax.md +++ b/crates/ty_python_semantic/resources/mdtest/import/invalid_syntax.md @@ -14,7 +14,7 @@ TODO: This is correctly flagged as an error, but we could clean up the diagnosti ```py # TODO: No second diagnostic -# error: [invalid-syntax] "Expected ',', found '.'" +# error: [invalid-syntax] "Expected `,`, found `.`" # error: [unresolved-import] "Module `a` has no member `c`" from a import b.c