test: update snapshots with just whitespace changes

These snapshot changes should *all* only be a result of changes to
trailing whitespace in the output. I checked a psuedo random sample of
these, and the whitespace found in the previous snapshots seems to be an
artifact of the rendering and _not_ of the source data. So this seems
like a strict bug fix to me.

There are other snapshots with whitespace changes, but they also have
other changes that we split out into separate commits. Basically, we're
going to do approximately one commit per category of change.

This represents, by far, the biggest chunk of changes to snapshots as a
result of the `annotate-snippets` upgrade.
This commit is contained in:
Andrew Gallant 2025-01-07 10:45:21 -05:00 committed by Andrew Gallant
parent 2922490cb8
commit 0de8216a25
779 changed files with 3619 additions and 4333 deletions

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/arguments/double_starred.py
snapshot_kind: text
---
## AST
@ -201,14 +200,14 @@ Module(
2 | call(** *x)
3 | call(***x)
| ^^ Syntax Error: Starred expression cannot be used here
4 |
4 |
5 | call(**x := 1)
|
|
3 | call(***x)
4 |
4 |
5 | call(**x := 1)
| ^^ Syntax Error: Expected ',', found ':='
|
@ -216,7 +215,7 @@ Module(
|
3 | call(***x)
4 |
4 |
5 | call(**x := 1)
| ^ Syntax Error: Positional argument cannot follow keyword argument unpacking
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/arguments/invalid_expression.py
snapshot_kind: text
---
## AST
@ -179,14 +178,14 @@ Module(
1 | call(x + y = 1)
2 | call(x := 1 = 1)
| ^^^^^^ Syntax Error: Expected a parameter name
3 |
3 |
4 | call(yield x)
|
|
2 | call(x := 1 = 1)
3 |
3 |
4 | call(yield x)
| ^^^^^^^ Syntax Error: Yield expression cannot be used here
5 | call(yield from x)

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/arguments/missing_expression.py
snapshot_kind: text
---
## AST
@ -162,6 +161,6 @@ Module(
2 | call(x = )
3 | call(*, y)
| ^ Syntax Error: Expected an expression
4 |
4 |
5 | foo
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/arguments/unclosed_0.py
snapshot_kind: text
---
## AST
@ -69,7 +68,7 @@ Module(
|
1 | call(
| ^ Syntax Error: Expected ')', found newline
2 |
2 |
3 | def foo():
4 | pass
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/arguments/unclosed_1.py
snapshot_kind: text
---
## AST
@ -77,7 +76,7 @@ Module(
|
1 | call(x
| ^ Syntax Error: Expected ')', found newline
2 |
2 |
3 | def foo():
4 | pass
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/arguments/unclosed_2.py
snapshot_kind: text
---
## AST
@ -77,7 +76,7 @@ Module(
|
1 | call(x,
| ^ Syntax Error: Expected ')', found newline
2 |
2 |
3 | def foo():
4 | pass
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/await/no_expression_0.py
snapshot_kind: text
---
## AST
@ -62,6 +61,6 @@ Module(
1 | # No expression after `await`, an expression on another line
2 | await
| ^ Syntax Error: Expected an expression
3 |
3 |
4 | x + y
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/await/no_expression_1.py
snapshot_kind: text
---
## AST
@ -65,7 +64,7 @@ Module(
1 | # No expression after `await`, a statement on another line
2 | await
| ^ Syntax Error: Expected an expression
3 |
3 |
4 | def foo():
5 | pass
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/await/recover.py
snapshot_kind: text
---
## AST
@ -249,7 +248,7 @@ Module(
4 | # Nested await
5 | await await x
| ^^^^^^^ Syntax Error: Await expression cannot be used here
6 |
6 |
7 | # Starred expressions
|
@ -267,7 +266,7 @@ Module(
8 | await *x
9 | await (*x)
| ^^ Syntax Error: Starred expression cannot be used here
10 |
10 |
11 | # Invalid expression as per precedence
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/bin_op/invalid_rhs_expression.py
snapshot_kind: text
---
## AST
@ -104,14 +103,14 @@ Module(
|
1 | x + lambda y: y
| ^^^^^^^^^^^ Syntax Error: Lambda expression cannot be used here
2 |
2 |
3 | x - yield y
|
|
1 | x + lambda y: y
2 |
2 |
3 | x - yield y
| ^^^^^^^ Syntax Error: Yield expression cannot be used here
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/bin_op/missing_lhs.py
snapshot_kind: text
---
## AST
@ -58,6 +57,6 @@ Module(
|
1 | / y
| ^ Syntax Error: Expected a statement
2 |
2 |
3 | 1 + 2
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/bin_op/missing_rhs_0.py
snapshot_kind: text
---
## AST
@ -72,6 +71,6 @@ Module(
|
1 | 0 +
| ^ Syntax Error: Expected an expression
2 |
2 |
3 | 1 + 2
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/bin_op/missing_rhs_1.py
snapshot_kind: text
---
## AST
@ -100,6 +99,6 @@ Module(
|
1 | 1 + 2 - 3 *
| ^ Syntax Error: Expected an expression
2 |
2 |
3 | 4 + 5
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/bool_op/invalid_rhs_expression.py
snapshot_kind: text
---
## AST
@ -108,14 +107,14 @@ Module(
|
1 | x and lambda y: y
| ^^^^^^^^^^^ Syntax Error: Lambda expression cannot be used here
2 |
2 |
3 | x or yield y
|
|
1 | x and lambda y: y
2 |
2 |
3 | x or yield y
| ^^^^^^^ Syntax Error: Yield expression cannot be used here
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/bool_op/missing_rhs.py
snapshot_kind: text
---
## AST
@ -73,6 +72,6 @@ Module(
|
1 | x and
| ^ Syntax Error: Expected an expression
2 |
2 |
3 | 1 + 2
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/compare/invalid_order.py
snapshot_kind: text
---
## AST
@ -134,7 +133,7 @@ Module(
|
1 | x in not y
| ^^^^^ Syntax Error: Boolean 'not' expression cannot be used here
2 |
2 |
3 | # `=>` instead of `>=`
|
@ -143,7 +142,7 @@ Module(
3 | # `=>` instead of `>=`
4 | x => y
| ^ Syntax Error: Expected an expression
5 |
5 |
6 | # Same here as well, `not` without `in` is considered to be a unary operator
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/compare/invalid_rhs_expression.py
snapshot_kind: text
---
## AST
@ -112,14 +111,14 @@ Module(
|
1 | x not in lambda y: y
| ^^^^^^^^^^^ Syntax Error: Lambda expression cannot be used here
2 |
2 |
3 | x == yield y
|
|
1 | x not in lambda y: y
2 |
2 |
3 | x == yield y
| ^^^^^^^ Syntax Error: Yield expression cannot be used here
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/compare/missing_lhs.py
snapshot_kind: text
---
## AST
@ -58,6 +57,6 @@ Module(
|
1 | > y
| ^ Syntax Error: Expected a statement
2 |
2 |
3 | 1 + 2
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/compare/missing_rhs_0.py
snapshot_kind: text
---
## AST
@ -75,6 +74,6 @@ Module(
|
1 | x >
| ^ Syntax Error: Expected an expression
2 |
2 |
3 | 1 + 2
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/compare/missing_rhs_1.py
snapshot_kind: text
---
## AST
@ -77,7 +76,7 @@ Module(
1 | # Without the `in`, this is considered to be a unary `not`
2 | x not
| ^^^ Syntax Error: Simple statements must be separated by newlines or semicolons
3 |
3 |
4 | 1 + 2
|
@ -86,6 +85,6 @@ Module(
1 | # Without the `in`, this is considered to be a unary `not`
2 | x not
| ^ Syntax Error: Expected an expression
3 |
3 |
4 | 1 + 2
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/compare/missing_rhs_2.py
snapshot_kind: text
---
## AST
@ -75,6 +74,6 @@ Module(
|
1 | x is not
| ^ Syntax Error: Expected an expression
2 |
2 |
3 | 1 + 2
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/compare/starred_expression.py
snapshot_kind: text
---
## AST
@ -167,14 +166,14 @@ Module(
1 | x >= *y
2 | x not in *y
| ^^ Syntax Error: Starred expression cannot be used here
3 |
3 |
4 | *x < y
|
|
2 | x not in *y
3 |
3 |
4 | *x < y
| ^^^^^ Syntax Error: Comparison expression cannot be used here
5 | *x is not y

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/dict/comprehension.py
snapshot_kind: text
---
## AST
@ -749,7 +748,7 @@ Module(
4 | {x: y for call() in y}
5 | {x: y for {a, b} in y}
| ^^^^^^ Syntax Error: Invalid assignment target
6 |
6 |
7 | # Invalid iter
|
@ -787,7 +786,7 @@ Module(
10 | {x: y for x in yield from y}
11 | {x: y for x in lambda y: y}
| ^^^^^^^^^^^ Syntax Error: Lambda expression cannot be used here
12 |
12 |
13 | # Invalid if
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/dict/double_star.py
snapshot_kind: text
---
## AST
@ -482,7 +481,7 @@ Module(
|
2 | # the ones which are higher than that.
3 |
3 |
4 | {**x := 1}
| ^^ Syntax Error: Expected ',', found ':='
5 | {a: 1, **x if True else y}
@ -492,7 +491,7 @@ Module(
|
2 | # the ones which are higher than that.
3 |
3 |
4 | {**x := 1}
| ^ Syntax Error: Expected ':', found '}'
5 | {a: 1, **x if True else y}

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/dict/double_star_comprehension.py
snapshot_kind: text
---
## AST
@ -111,49 +110,49 @@ Module(
|
2 | # it's actually a comprehension.
3 |
3 |
4 | {**x: y for x, y in data}
| ^ Syntax Error: Expected an expression or a '}'
5 |
5 |
6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y`
|
|
2 | # it's actually a comprehension.
3 |
3 |
4 | {**x: y for x, y in data}
| ^^^ Syntax Error: Expected ':', found 'for'
5 |
5 |
6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y`
|
|
2 | # it's actually a comprehension.
3 |
3 |
4 | {**x: y for x, y in data}
| ^ Syntax Error: Expected ',', found name
5 |
5 |
6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y`
|
|
2 | # it's actually a comprehension.
3 |
3 |
4 | {**x: y for x, y in data}
| ^ Syntax Error: Expected ':', found ','
5 |
5 |
6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y`
|
|
2 | # it's actually a comprehension.
3 |
3 |
4 | {**x: y for x, y in data}
| ^ Syntax Error: Expected ':', found '}'
5 |
5 |
6 | # TODO(dhruvmanila): This test case fails because there's no way to represent `**y`
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/dict/missing_closing_brace_2.py
snapshot_kind: text
---
## AST
@ -78,7 +77,7 @@ Module(
|
1 | {x: 1,
| ^ Syntax Error: Expected '}', found newline
2 |
2 |
3 | def foo():
4 | pass
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/dict/named_expression_0.py
snapshot_kind: text
---
## AST
@ -123,19 +122,19 @@ Module(
|
1 | # Unparenthesized named expression not allowed in key
2 |
2 |
3 | {x := 1: y, z := 2: a}
| ^^^^^^ Syntax Error: Unparenthesized named expression cannot be used here
4 |
4 |
5 | x + y
|
|
1 | # Unparenthesized named expression not allowed in key
2 |
2 |
3 | {x := 1: y, z := 2: a}
| ^^ Syntax Error: Expected ':', found ':='
4 |
4 |
5 | x + y
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/dict/named_expression_1.py
snapshot_kind: text
---
## AST
@ -129,39 +128,39 @@ Module(
|
1 | # Unparenthesized named expression not allowed in value
2 |
2 |
3 | {x: y := 1, z: a := 2}
| ^^ Syntax Error: Expected ',', found ':='
4 |
4 |
5 | x + y
|
|
1 | # Unparenthesized named expression not allowed in value
2 |
2 |
3 | {x: y := 1, z: a := 2}
| ^ Syntax Error: Expected ':', found ','
4 |
4 |
5 | x + y
|
|
1 | # Unparenthesized named expression not allowed in value
2 |
2 |
3 | {x: y := 1, z: a := 2}
| ^^ Syntax Error: Expected ',', found ':='
4 |
4 |
5 | x + y
|
|
1 | # Unparenthesized named expression not allowed in value
2 |
2 |
3 | {x: y := 1, z: a := 2}
| ^ Syntax Error: Expected ':', found '}'
4 |
4 |
5 | x + y
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/dict/recover.py
snapshot_kind: text
---
## AST
@ -422,30 +421,30 @@ Module(
|
1 | # Test cases for dictionary expressions where the parser recovers from a syntax error.
2 |
2 |
3 | {,}
| ^ Syntax Error: Expected an expression
4 |
4 |
5 | {1: 2,,3: 4}
|
|
3 | {,}
4 |
4 |
5 | {1: 2,,3: 4}
| ^ Syntax Error: Expected an expression or a '}'
6 |
6 |
7 | {1: 2,,}
|
|
5 | {1: 2,,3: 4}
6 |
6 |
7 | {1: 2,,}
| ^ Syntax Error: Expected an expression or a '}'
8 |
8 |
9 | # Missing comma
|
@ -454,7 +453,7 @@ Module(
9 | # Missing comma
10 | {1: 2 3: 4}
| ^ Syntax Error: Expected ',', found int
11 |
11 |
12 | # No value
|
@ -463,7 +462,7 @@ Module(
12 | # No value
13 | {1: }
| ^ Syntax Error: Expected an expression
14 |
14 |
15 | # No value for double star unpacking
|
@ -481,7 +480,7 @@ Module(
16 | {**}
17 | {x: y, **, a: b}
| ^ Syntax Error: Expected an expression
18 |
18 |
19 | # This is not a double star unpacking
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/emoji_identifiers.py
snapshot_kind: text
---
## AST
@ -89,7 +88,7 @@ Module(
2 | # comment 🐶
3 | )
| ^ Syntax Error: Expected a statement
4 |
4 |
5 | a = (🐶 +
|
@ -99,7 +98,7 @@ Module(
2 | # comment 🐶
3 | )
| ^ Syntax Error: Expected a statement
4 |
4 |
5 | a = (🐶 +
6 | # comment
|
@ -107,7 +106,7 @@ Module(
|
3 | )
4 |
4 |
5 | a = (🐶 +
| ^^ Syntax Error: Got unexpected token 🐶
6 | # comment

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/if/missing_orelse_expr_0.py
snapshot_kind: text
---
## AST
@ -79,7 +78,7 @@ Module(
1 | # Missing orelse expression, followed by a statement
2 | x if expr else
| ^ Syntax Error: Expected an expression
3 |
3 |
4 | def foo():
5 | pass
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/if/missing_orelse_expr_1.py
snapshot_kind: text
---
## AST
@ -78,6 +77,6 @@ Module(
1 | # Missing orelse expression, followed by an expression
2 | x if expr else
| ^ Syntax Error: Expected an expression
3 |
3 |
4 | 1 + 1
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/if/missing_test_expr_0.py
snapshot_kind: text
---
## AST
@ -79,7 +78,7 @@ Module(
1 | # Missing test expression, followed by a statement
2 | x if
| ^ Syntax Error: Expected an expression
3 |
3 |
4 | def foo():
5 | pass
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/if/missing_test_expr_1.py
snapshot_kind: text
---
## AST
@ -78,6 +77,6 @@ Module(
1 | # Missing test expression, followed by an expression
2 | x if
| ^ Syntax Error: Expected an expression
3 |
3 |
4 | 1 + 1
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/if/recover.py
snapshot_kind: text
---
## AST
@ -330,7 +329,7 @@ Module(
4 | x if yield x else y
5 | x if yield from x else y
| ^^^^^^^^^^^^ Syntax Error: Yield expression cannot be used here
6 |
6 |
7 | # Invalid orelse expression
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/lambda_duplicate_parameters.py
snapshot_kind: text
---
## AST
@ -288,44 +287,44 @@ Module(
|
1 | lambda a, a: 1
| ^ Syntax Error: Duplicate parameter "a"
2 |
2 |
3 | lambda a, *, a: 1
|
|
1 | lambda a, a: 1
2 |
2 |
3 | lambda a, *, a: 1
| ^ Syntax Error: Duplicate parameter "a"
4 |
4 |
5 | lambda a, a=20: 1
|
|
3 | lambda a, *, a: 1
4 |
4 |
5 | lambda a, a=20: 1
| ^ Syntax Error: Duplicate parameter "a"
6 |
6 |
7 | lambda a, *a: 1
|
|
5 | lambda a, a=20: 1
6 |
6 |
7 | lambda a, *a: 1
| ^ Syntax Error: Duplicate parameter "a"
8 |
8 |
9 | lambda a, *, **a: 1
|
|
7 | lambda a, *a: 1
8 |
8 |
9 | lambda a, *, **a: 1
| ^^^ Syntax Error: Expected one or more keyword parameter after '*' separator
|
@ -333,7 +332,7 @@ Module(
|
7 | lambda a, *a: 1
8 |
8 |
9 | lambda a, *, **a: 1
| ^ Syntax Error: Duplicate parameter "a"
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/list/comprehension.py
snapshot_kind: text
---
## AST
@ -680,7 +679,7 @@ Module(
1 | # Iterable unpacking not allowed
2 | [*x for x in y]
| ^^ Syntax Error: Iterable unpacking cannot be used in a comprehension
3 |
3 |
4 | # Invalid target
|
@ -718,7 +717,7 @@ Module(
7 | [x for call() in y]
8 | [x for {a, b} in y]
| ^^^^^^ Syntax Error: Invalid assignment target
9 |
9 |
10 | # Invalid iter
|
@ -756,7 +755,7 @@ Module(
13 | [x for x in yield from y]
14 | [x for x in lambda y: y]
| ^^^^^^^^^^^ Syntax Error: Lambda expression cannot be used here
15 |
15 |
16 | # Invalid if
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/list/missing_closing_bracket_3.py
snapshot_kind: text
---
## AST
@ -75,10 +74,10 @@ Module(
|
2 | # token starts a statement.
3 |
3 |
4 | [1, 2
| ^ Syntax Error: Expected ']', found newline
5 |
5 |
6 | def foo():
7 | pass
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/list/recover.py
snapshot_kind: text
---
## AST
@ -242,30 +241,30 @@ Module(
|
1 | # Test cases for list expressions where the parser recovers from a syntax error.
2 |
2 |
3 | [,]
| ^ Syntax Error: Expected an expression
4 |
4 |
5 | [1,,2]
|
|
3 | [,]
4 |
4 |
5 | [1,,2]
| ^ Syntax Error: Expected an expression or a ']'
6 |
6 |
7 | [1,,]
|
|
5 | [1,,2]
6 |
6 |
7 | [1,,]
| ^ Syntax Error: Expected an expression or a ']'
8 |
8 |
9 | # Missing comma
|
@ -274,7 +273,7 @@ Module(
9 | # Missing comma
10 | [1 2]
| ^ Syntax Error: Expected ',', found int
11 |
11 |
12 | # Dictionary element in a list
|
@ -283,7 +282,7 @@ Module(
12 | # Dictionary element in a list
13 | [1: 2]
| ^ Syntax Error: Expected an expression or a ']'
14 |
14 |
15 | # Missing expression
|
@ -292,24 +291,24 @@ Module(
15 | # Missing expression
16 | [1, x + ]
| ^ Syntax Error: Expected an expression
17 |
17 |
18 | [1; 2]
|
|
16 | [1, x + ]
17 |
17 |
18 | [1; 2]
| ^ Syntax Error: Expected an expression or a ']'
19 |
19 |
20 | [*]
|
|
18 | [1; 2]
19 |
19 |
20 | [*]
| ^ Syntax Error: Expected an expression
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/list/star_expression_precedence.py
snapshot_kind: text
---
## AST
@ -394,7 +393,7 @@ Module(
|
1 | # For list expression, the minimum binding power of star expression is bitwise or.
2 |
2 |
3 | [(*x), y]
| ^^ Syntax Error: Starred expression cannot be used here
4 | [*x in y, z]

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/named/invalid_target.py
snapshot_kind: text
---
## AST
@ -178,7 +177,7 @@ Module(
|
1 | # Assignment expression target can only be an identifier
2 |
2 |
3 | (x.y := 1)
| ^^^ Syntax Error: Assignment expression target must be an identifier
4 | (x[y] := 1)

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/named/missing_expression_4.py
snapshot_kind: text
---
## AST
@ -67,9 +66,9 @@ Module(
|
1 | # No expression on the right side of the assignment expression
2 |
2 |
3 | (x := )
| ^ Syntax Error: Expected an expression
4 |
4 |
5 | x + y
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/parenthesized/missing_closing_paren_3.py
snapshot_kind: text
---
## AST
@ -76,10 +75,10 @@ Module(
|
2 | # token starts a statement.
3 |
3 |
4 | (1, 2
| ^ Syntax Error: Expected ')', found newline
5 |
5 |
6 | def foo():
7 | pass
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/parenthesized/parenthesized.py
snapshot_kind: text
---
## AST
@ -63,7 +62,7 @@ Module(
1 | # Starred expression isn't allowed in a parenthesized expression.
2 | (*x)
| ^^ Syntax Error: Starred expression cannot be used here
3 |
3 |
4 | # Unparenthesized named expression is allowed.
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/parenthesized/tuple.py
snapshot_kind: text
---
## AST
@ -251,30 +250,30 @@ Module(
|
1 | # Test cases for tuple expressions where the parser recovers from a syntax error.
2 |
2 |
3 | (,)
| ^ Syntax Error: Expected an expression
4 |
4 |
5 | (1,,2)
|
|
3 | (,)
4 |
4 |
5 | (1,,2)
| ^ Syntax Error: Expected an expression or a ')'
6 |
6 |
7 | (1,,)
|
|
5 | (1,,2)
6 |
6 |
7 | (1,,)
| ^ Syntax Error: Expected an expression or a ')'
8 |
8 |
9 | # Missing comma
|
@ -283,7 +282,7 @@ Module(
9 | # Missing comma
10 | (1 2)
| ^ Syntax Error: Expected ')', found int
11 |
11 |
12 | # Dictionary element in a list
|
@ -292,7 +291,7 @@ Module(
9 | # Missing comma
10 | (1 2)
| ^ Syntax Error: Expected a statement
11 |
11 |
12 | # Dictionary element in a list
|
@ -301,7 +300,7 @@ Module(
9 | # Missing comma
10 | (1 2)
| ^ Syntax Error: Expected a statement
11 |
11 |
12 | # Dictionary element in a list
13 | (1: 2)
|
@ -311,7 +310,7 @@ Module(
12 | # Dictionary element in a list
13 | (1: 2)
| ^ Syntax Error: Expected ')', found ':'
14 |
14 |
15 | # Missing expression
|
@ -320,7 +319,7 @@ Module(
12 | # Dictionary element in a list
13 | (1: 2)
| ^ Syntax Error: Invalid annotated assignment target
14 |
14 |
15 | # Missing expression
|
@ -329,7 +328,7 @@ Module(
12 | # Dictionary element in a list
13 | (1: 2)
| ^ Syntax Error: Expected a statement
14 |
14 |
15 | # Missing expression
|
@ -338,7 +337,7 @@ Module(
12 | # Dictionary element in a list
13 | (1: 2)
| ^ Syntax Error: Expected a statement
14 |
14 |
15 | # Missing expression
16 | (1, x + )
|
@ -348,37 +347,37 @@ Module(
15 | # Missing expression
16 | (1, x + )
| ^ Syntax Error: Expected an expression
17 |
17 |
18 | (1; 2)
|
|
16 | (1, x + )
17 |
17 |
18 | (1; 2)
| ^ Syntax Error: Expected ')', found ';'
19 |
19 |
20 | # Unparenthesized named expression is not allowed
|
|
16 | (1, x + )
17 |
17 |
18 | (1; 2)
| ^ Syntax Error: Expected a statement
19 |
19 |
20 | # Unparenthesized named expression is not allowed
|
|
16 | (1, x + )
17 |
17 |
18 | (1; 2)
| ^ Syntax Error: Expected a statement
19 |
19 |
20 | # Unparenthesized named expression is not allowed
21 | x, y := 2, z
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/parenthesized/tuple_starred_expr.py
snapshot_kind: text
---
## AST
@ -1119,7 +1118,7 @@ Module(
|
2 | # Test the first and any other element as the there are two separate calls.
3 |
3 |
4 | (*x in y, z, *x in y)
| ^^^^^^ Syntax Error: Comparison expression cannot be used here
5 | (*not x, z, *not x)
@ -1129,7 +1128,7 @@ Module(
|
2 | # Test the first and any other element as the there are two separate calls.
3 |
3 |
4 | (*x in y, z, *x in y)
| ^^^^^^ Syntax Error: Comparison expression cannot be used here
5 | (*not x, z, *not x)

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/set/comprehension.py
snapshot_kind: text
---
## AST
@ -680,7 +679,7 @@ Module(
1 | # Iterable unpacking not allowed
2 | {*x for x in y}
| ^^ Syntax Error: Iterable unpacking cannot be used in a comprehension
3 |
3 |
4 | # Invalid target
|
@ -718,7 +717,7 @@ Module(
7 | {x for call() in y}
8 | {x for {a, b} in y}
| ^^^^^^ Syntax Error: Invalid assignment target
9 |
9 |
10 | # Invalid iter
|
@ -756,7 +755,7 @@ Module(
13 | {x for x in yield from y}
14 | {x for x in lambda y: y}
| ^^^^^^^^^^^ Syntax Error: Lambda expression cannot be used here
15 |
15 |
16 | # Invalid if
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/set/missing_closing_curly_brace_3.py
snapshot_kind: text
---
## AST
@ -74,10 +73,10 @@ Module(
|
2 | # token starts a statement.
3 |
3 |
4 | {1, 2
| ^ Syntax Error: Expected '}', found newline
5 |
5 |
6 | def foo():
7 | pass
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/set/recover.py
snapshot_kind: text
---
## AST
@ -239,30 +238,30 @@ Module(
|
3 | # These are same as for the list expressions.
4 |
4 |
5 | {,}
| ^ Syntax Error: Expected an expression
6 |
6 |
7 | {1,,2}
|
|
5 | {,}
6 |
6 |
7 | {1,,2}
| ^ Syntax Error: Expected an expression or a '}'
8 |
8 |
9 | {1,,}
|
|
7 | {1,,2}
8 |
8 |
9 | {1,,}
| ^ Syntax Error: Expected an expression or a '}'
10 |
10 |
11 | # Missing comma
|
@ -271,7 +270,7 @@ Module(
11 | # Missing comma
12 | {1 2}
| ^ Syntax Error: Expected ',', found int
13 |
13 |
14 | # Dictionary element in a list
|
@ -280,24 +279,24 @@ Module(
17 | # Missing expression
18 | {1, x + }
| ^ Syntax Error: Expected an expression
19 |
19 |
20 | {1; 2}
|
|
18 | {1, x + }
19 |
19 |
20 | {1; 2}
| ^ Syntax Error: Expected an expression or a '}'
21 |
21 |
22 | [*]
|
|
20 | {1; 2}
21 |
21 |
22 | [*]
| ^ Syntax Error: Expected an expression
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/set/star_expression_precedence.py
snapshot_kind: text
---
## AST
@ -386,7 +385,7 @@ Module(
|
1 | # For set expression, the minimum binding power of star expression is bitwise or.
2 |
2 |
3 | {(*x), y}
| ^^ Syntax Error: Starred expression cannot be used here
4 | {*x in y, z}

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/subscript/invalid_slice_element.py
snapshot_kind: text
---
## AST
@ -255,7 +254,7 @@ Module(
|
1 | x[x := 1:]
| ^^^^^^ Syntax Error: Unparenthesized named expression cannot be used here
2 |
2 |
3 | # Starred expression
|
@ -283,7 +282,7 @@ Module(
5 | x[:*x]
6 | x[::*x]
| ^^ Syntax Error: Starred expression cannot be used here
7 |
7 |
8 | # Empty slice
|
@ -292,7 +291,7 @@ Module(
8 | # Empty slice
9 | x[]
| ^ Syntax Error: Expected index or slice expression
10 |
10 |
11 | # Mixed starred expression and named expression
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/unary/no_expression_0.py
snapshot_kind: text
---
## AST
@ -62,6 +61,6 @@ Module(
|
1 | not
| ^ Syntax Error: Expected an expression
2 |
2 |
3 | x + y
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/unary/no_expression_1.py
snapshot_kind: text
---
## AST
@ -62,6 +61,6 @@ Module(
|
1 | +
| ^ Syntax Error: Expected an expression
2 |
2 |
3 | x + y
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/yield/named_expression.py
snapshot_kind: text
---
## AST
@ -104,14 +103,14 @@ Module(
1 | # Unparenthesized named expressions are not allowed
2 | yield x := 1
| ^^ Syntax Error: Expected a statement
3 |
3 |
4 | yield 1, x := 2, 3
|
|
2 | yield x := 1
3 |
3 |
4 | yield 1, x := 2, 3
| ^^ Syntax Error: Expected ',', found ':='
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/yield/star_expression.py
snapshot_kind: text
---
## AST
@ -101,14 +100,14 @@ Module(
1 | # Cannot use starred expression here
2 | yield (*x)
| ^^ Syntax Error: Starred expression cannot be used here
3 |
3 |
4 | yield *x and y, z
|
|
2 | yield (*x)
3 |
3 |
4 | yield *x and y, z
| ^^^^^^^ Syntax Error: Boolean expression cannot be used here
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/yield_from/starred_expression.py
snapshot_kind: text
---
## AST
@ -80,7 +79,7 @@ Module(
|
1 | # Yield from doesn't allow top-level starred expression unlike yield
2 |
2 |
3 | yield from *x
| ^^ Syntax Error: Starred expression cannot be used here
4 | yield from *x, y

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/yield_from/unparenthesized.py
snapshot_kind: text
---
## AST
@ -137,7 +136,7 @@ Module(
1 | # Unparenthesized named expression
2 | yield from x := 1
| ^^ Syntax Error: Expected a statement
3 |
3 |
4 | # Unparenthesized tuple expression
|
@ -146,7 +145,7 @@ Module(
4 | # Unparenthesized tuple expression
5 | yield from x, y
| ^^^^ Syntax Error: Unparenthesized tuple expression cannot be used here
6 |
6 |
7 | # This is a tuple expression parsing
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/re_lexing/line_continuation_1.py
snapshot_kind: text
---
## AST
@ -84,7 +83,7 @@ Module(
|
1 | call(a, b, \\\
| ^ Syntax Error: Expected a newline after line continuation character
2 |
2 |
3 | def bar():
|
@ -92,14 +91,14 @@ Module(
|
1 | call(a, b, \\\
| ^ Syntax Error: Expected a newline after line continuation character
2 |
2 |
3 | def bar():
|
|
1 | call(a, b, \\\
2 |
2 |
| ^ Syntax Error: Expected ')', found newline
3 | def bar():
4 | pass

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/statements/function_type_parameters.py
snapshot_kind: text
---
## AST
@ -324,57 +323,57 @@ Module(
|
9 | # on following lines.
10 |
10 |
11 | def keyword[A, await](): ...
| ^^^^^ Syntax Error: Expected an identifier, but found a keyword 'await' that cannot be used here
12 |
12 |
13 | def not_a_type_param[A, |, B](): ...
|
|
11 | def keyword[A, await](): ...
12 |
12 |
13 | def not_a_type_param[A, |, B](): ...
| ^ Syntax Error: Expected ',', found '|'
14 |
14 |
15 | def multiple_commas[A,,B](): ...
|
|
11 | def keyword[A, await](): ...
12 |
12 |
13 | def not_a_type_param[A, |, B](): ...
| ^ Syntax Error: Expected a type parameter or the end of the type parameter list
14 |
14 |
15 | def multiple_commas[A,,B](): ...
|
|
13 | def not_a_type_param[A, |, B](): ...
14 |
14 |
15 | def multiple_commas[A,,B](): ...
| ^ Syntax Error: Expected a type parameter or the end of the type parameter list
16 |
16 |
17 | def multiple_trailing_commas[A,,](): ...
|
|
15 | def multiple_commas[A,,B](): ...
16 |
16 |
17 | def multiple_trailing_commas[A,,](): ...
| ^ Syntax Error: Expected a type parameter or the end of the type parameter list
18 |
18 |
19 | def multiple_commas_and_recovery[A,,100](): ...
|
|
17 | def multiple_trailing_commas[A,,](): ...
18 |
18 |
19 | def multiple_commas_and_recovery[A,,100](): ...
| ^ Syntax Error: Expected a type parameter or the end of the type parameter list
|
@ -382,7 +381,7 @@ Module(
|
17 | def multiple_trailing_commas[A,,](): ...
18 |
18 |
19 | def multiple_commas_and_recovery[A,,100](): ...
| ^^^ Syntax Error: Expected ']', found int
|
@ -390,7 +389,7 @@ Module(
|
17 | def multiple_trailing_commas[A,,](): ...
18 |
18 |
19 | def multiple_commas_and_recovery[A,,100](): ...
| ^ Syntax Error: Expected newline, found ']'
|
@ -398,7 +397,7 @@ Module(
|
17 | def multiple_trailing_commas[A,,](): ...
18 |
18 |
19 | def multiple_commas_and_recovery[A,,100](): ...
| ^^ Syntax Error: Only single target (not tuple) can be annotated
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/statements/invalid_assignment_targets.py
snapshot_kind: text
---
## AST
@ -1383,30 +1382,30 @@ Module(
|
3 | # rejected by the parser. e.g., `5 = 3`, `5 += 3`, `(5): int = 3`.
4 |
4 |
5 | 5 = 3
| ^ Syntax Error: Invalid assignment target
6 |
6 |
7 | 5 += 3
|
|
5 | 5 = 3
6 |
6 |
7 | 5 += 3
| ^ Syntax Error: Invalid augmented assignment target
8 |
8 |
9 | (5): int = 3
|
|
7 | 5 += 3
8 |
8 |
9 | (5): int = 3
| ^ Syntax Error: Invalid annotated assignment target
10 |
10 |
11 | # Now we exhaustively test all possible cases where assignment can fail.
|
@ -1574,14 +1573,14 @@ Module(
27 | a < b < c = 42
28 | foo() = 42
| ^^^^^ Syntax Error: Invalid assignment target
29 |
29 |
30 | f"{quux}" = 42
|
|
28 | foo() = 42
29 |
29 |
30 | f"{quux}" = 42
| ^^^^^^^^^ Syntax Error: Invalid assignment target
31 | f"{foo} and {bar}" = 42
@ -1592,14 +1591,14 @@ Module(
30 | f"{quux}" = 42
31 | f"{foo} and {bar}" = 42
| ^^^^^^^^^^^^^^^^^^ Syntax Error: Invalid assignment target
32 |
32 |
33 | "foo" = 42
|
|
31 | f"{foo} and {bar}" = 42
32 |
32 |
33 | "foo" = 42
| ^^^^^ Syntax Error: Invalid assignment target
34 | b"foo" = 42

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/statements/invalid_augmented_assignment_target.py
snapshot_kind: text
---
## AST
@ -1278,7 +1277,7 @@ Module(
|
2 | # assignment targets.
3 |
3 |
4 | x or y += 42
| ^^^^^^ Syntax Error: Invalid augmented assignment target
5 | (x := 5) += 42
@ -1439,14 +1438,14 @@ Module(
19 | a < b < c += 42
20 | foo() += 42
| ^^^^^ Syntax Error: Invalid augmented assignment target
21 |
21 |
22 | f"{quux}" += 42
|
|
20 | foo() += 42
21 |
21 |
22 | f"{quux}" += 42
| ^^^^^^^^^ Syntax Error: Invalid augmented assignment target
23 | f"{foo} and {bar}" += 42
@ -1457,14 +1456,14 @@ Module(
22 | f"{quux}" += 42
23 | f"{foo} and {bar}" += 42
| ^^^^^^^^^^^^^^^^^^ Syntax Error: Invalid augmented assignment target
24 |
24 |
25 | "foo" += 42
|
|
23 | f"{foo} and {bar}" += 42
24 |
24 |
25 | "foo" += 42
| ^^^^^ Syntax Error: Invalid augmented assignment target
26 | b"foo" += 42

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/statements/with/ambiguous_lpar_with_items.py
snapshot_kind: text
---
## AST
@ -1362,7 +1361,7 @@ Module(
|
2 | # These cases should raise the correct syntax error and recover properly.
3 |
3 |
4 | with (item1, item2),: ...
| ^ Syntax Error: Trailing comma not allowed
5 | with (item1, item2), as f: ...
@ -1452,7 +1451,7 @@ Module(
11 | with (x for x in range(10), item): ...
12 | with (item, x for x in range(10)): ...
| ^^^ Syntax Error: Expected ')', found 'for'
13 |
13 |
14 | # Make sure the parser doesn't report the same error twice
|
@ -1462,7 +1461,7 @@ Module(
11 | with (x for x in range(10), item): ...
12 | with (item, x for x in range(10)): ...
| ^ Syntax Error: Expected ':', found ')'
13 |
13 |
14 | # Make sure the parser doesn't report the same error twice
|
@ -1472,7 +1471,7 @@ Module(
11 | with (x for x in range(10), item): ...
12 | with (item, x for x in range(10)): ...
| ^ Syntax Error: Expected a statement
13 |
13 |
14 | # Make sure the parser doesn't report the same error twice
|
@ -1481,14 +1480,14 @@ Module(
14 | # Make sure the parser doesn't report the same error twice
15 | with ((*item)): ...
| ^^^^^ Syntax Error: Starred expression cannot be used here
16 |
16 |
17 | with (*x for x in iter, item): ...
|
|
15 | with ((*item)): ...
16 |
16 |
17 | with (*x for x in iter, item): ...
| ^^ Syntax Error: Iterable unpacking cannot be used in a comprehension
18 | with (item1, *x for x in iter, item2): ...
@ -1498,7 +1497,7 @@ Module(
|
15 | with ((*item)): ...
16 |
16 |
17 | with (*x for x in iter, item): ...
| ^ Syntax Error: Expected ')', found ','
18 | with (item1, *x for x in iter, item2): ...
@ -1508,7 +1507,7 @@ Module(
|
15 | with ((*item)): ...
16 |
16 |
17 | with (*x for x in iter, item): ...
| ^ Syntax Error: Expected ',', found ')'
18 | with (item1, *x for x in iter, item2): ...
@ -1607,7 +1606,7 @@ Module(
24 | with (x as f, y) as f: ...
25 | with (x for x in iter as y): ...
| ^^ Syntax Error: Expected ')', found 'as'
26 |
26 |
27 | # The inner `(...)` is parsed as parenthesized expression
|
@ -1617,7 +1616,7 @@ Module(
24 | with (x as f, y) as f: ...
25 | with (x for x in iter as y): ...
| ^ Syntax Error: Expected ',', found ')'
26 |
26 |
27 | # The inner `(...)` is parsed as parenthesized expression
|
@ -1626,7 +1625,7 @@ Module(
27 | # The inner `(...)` is parsed as parenthesized expression
28 | with ((item as f)): ...
| ^^ Syntax Error: Expected ')', found 'as'
29 |
29 |
30 | with (item as f), x: ...
|
@ -1635,7 +1634,7 @@ Module(
27 | # The inner `(...)` is parsed as parenthesized expression
28 | with ((item as f)): ...
| ^ Syntax Error: Expected ':', found ')'
29 |
29 |
30 | with (item as f), x: ...
|
@ -1644,14 +1643,14 @@ Module(
27 | # The inner `(...)` is parsed as parenthesized expression
28 | with ((item as f)): ...
| ^ Syntax Error: Expected a statement
29 |
29 |
30 | with (item as f), x: ...
|
|
28 | with ((item as f)): ...
29 |
29 |
30 | with (item as f), x: ...
| ^ Syntax Error: Expected ':', found ','
31 | with (item as f1) as f2: ...

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/statements/with/empty_with_items.py
snapshot_kind: text
---
## AST
@ -62,9 +61,9 @@ Module(
|
2 | # The parser should recover from this syntax error.
3 |
3 |
4 | with : ...
| ^ Syntax Error: Expected the start of an expression after `with` keyword
5 |
5 |
6 | x + y
|

View file

@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/statements/with/unparenthesized_with_items.py
snapshot_kind: text
---
## AST
@ -298,7 +297,7 @@ Module(
|
1 | # For parenthesized with items test cases, refer to `./ambiguous_lpar_with_items.py`
2 |
2 |
3 | with item,: pass
| ^ Syntax Error: Trailing comma not allowed
4 | with item as x,: pass