-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove commented out inline tests (#10857)
## Summary This PR removes a couple of inline tests TODO which was a leftover from #10809
- Loading branch information
1 parent
90f8f3d
commit 8d714d5
Showing
9 changed files
with
575 additions
and
4 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
crates/ruff_python_parser/resources/inline/err/assert_invalid_msg_expr.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
assert False, *x | ||
assert False, assert x | ||
assert False, yield x | ||
assert False, x := 1 |
4 changes: 4 additions & 0 deletions
4
crates/ruff_python_parser/resources/inline/err/assert_invalid_test_expr.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
assert *x | ||
assert assert x | ||
assert yield x | ||
assert x := 1 |
3 changes: 3 additions & 0 deletions
3
crates/ruff_python_parser/resources/inline/err/raise_stmt_invalid_cause.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
raise x from *y | ||
raise x from yield y | ||
raise x from y := 1 |
3 changes: 3 additions & 0 deletions
3
crates/ruff_python_parser/resources/inline/err/raise_stmt_invalid_exc.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
raise *x | ||
raise yield x | ||
raise x := 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
169 changes: 169 additions & 0 deletions
169
crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_invalid_msg_expr.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
--- | ||
source: crates/ruff_python_parser/tests/fixtures.rs | ||
input_file: crates/ruff_python_parser/resources/inline/err/assert_invalid_msg_expr.py | ||
--- | ||
## AST | ||
|
||
``` | ||
Module( | ||
ModModule { | ||
range: 0..83, | ||
body: [ | ||
Assert( | ||
StmtAssert { | ||
range: 0..16, | ||
test: BooleanLiteral( | ||
ExprBooleanLiteral { | ||
range: 7..12, | ||
value: false, | ||
}, | ||
), | ||
msg: Some( | ||
Starred( | ||
ExprStarred { | ||
range: 14..16, | ||
value: Name( | ||
ExprName { | ||
range: 15..16, | ||
id: "x", | ||
ctx: Load, | ||
}, | ||
), | ||
ctx: Load, | ||
}, | ||
), | ||
), | ||
}, | ||
), | ||
Assert( | ||
StmtAssert { | ||
range: 17..30, | ||
test: BooleanLiteral( | ||
ExprBooleanLiteral { | ||
range: 24..29, | ||
value: false, | ||
}, | ||
), | ||
msg: None, | ||
}, | ||
), | ||
Assert( | ||
StmtAssert { | ||
range: 31..39, | ||
test: Name( | ||
ExprName { | ||
range: 38..39, | ||
id: "x", | ||
ctx: Load, | ||
}, | ||
), | ||
msg: None, | ||
}, | ||
), | ||
Assert( | ||
StmtAssert { | ||
range: 40..61, | ||
test: BooleanLiteral( | ||
ExprBooleanLiteral { | ||
range: 47..52, | ||
value: false, | ||
}, | ||
), | ||
msg: Some( | ||
Yield( | ||
ExprYield { | ||
range: 54..61, | ||
value: Some( | ||
Name( | ||
ExprName { | ||
range: 60..61, | ||
id: "x", | ||
ctx: Load, | ||
}, | ||
), | ||
), | ||
}, | ||
), | ||
), | ||
}, | ||
), | ||
Assert( | ||
StmtAssert { | ||
range: 62..77, | ||
test: BooleanLiteral( | ||
ExprBooleanLiteral { | ||
range: 69..74, | ||
value: false, | ||
}, | ||
), | ||
msg: Some( | ||
Name( | ||
ExprName { | ||
range: 76..77, | ||
id: "x", | ||
ctx: Load, | ||
}, | ||
), | ||
), | ||
}, | ||
), | ||
Expr( | ||
StmtExpr { | ||
range: 81..82, | ||
value: NumberLiteral( | ||
ExprNumberLiteral { | ||
range: 81..82, | ||
value: Int( | ||
1, | ||
), | ||
}, | ||
), | ||
}, | ||
), | ||
], | ||
}, | ||
) | ||
``` | ||
## Errors | ||
|
||
| | ||
1 | assert False, *x | ||
| ^^ Syntax Error: starred expression cannot be used here | ||
2 | assert False, assert x | ||
3 | assert False, yield x | ||
| | ||
|
||
|
||
| | ||
1 | assert False, *x | ||
2 | assert False, assert x | ||
| ^^^^^^ Syntax Error: Expected an expression | ||
3 | assert False, yield x | ||
4 | assert False, x := 1 | ||
| | ||
|
||
|
||
| | ||
1 | assert False, *x | ||
2 | assert False, assert x | ||
| ^^^^^^^^^^^^^^^^^^^^ Syntax Error: use `;` to separate simple statements | ||
3 | assert False, yield x | ||
4 | assert False, x := 1 | ||
| | ||
|
||
|
||
| | ||
1 | assert False, *x | ||
2 | assert False, assert x | ||
3 | assert False, yield x | ||
| ^^^^^^^ Syntax Error: yield expression cannot be used here | ||
4 | assert False, x := 1 | ||
| | ||
|
||
|
||
| | ||
2 | assert False, assert x | ||
3 | assert False, yield x | ||
4 | assert False, x := 1 | ||
| ^^ Syntax Error: Expected a statement | ||
| |
148 changes: 148 additions & 0 deletions
148
crates/ruff_python_parser/tests/snapshots/invalid_syntax@assert_invalid_test_expr.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
--- | ||
source: crates/ruff_python_parser/tests/fixtures.rs | ||
input_file: crates/ruff_python_parser/resources/inline/err/assert_invalid_test_expr.py | ||
--- | ||
## AST | ||
|
||
``` | ||
Module( | ||
ModModule { | ||
range: 0..55, | ||
body: [ | ||
Assert( | ||
StmtAssert { | ||
range: 0..9, | ||
test: Starred( | ||
ExprStarred { | ||
range: 7..9, | ||
value: Name( | ||
ExprName { | ||
range: 8..9, | ||
id: "x", | ||
ctx: Load, | ||
}, | ||
), | ||
ctx: Load, | ||
}, | ||
), | ||
msg: None, | ||
}, | ||
), | ||
Assert( | ||
StmtAssert { | ||
range: 10..23, | ||
test: Name( | ||
ExprName { | ||
range: 17..23, | ||
id: "assert", | ||
ctx: Load, | ||
}, | ||
), | ||
msg: None, | ||
}, | ||
), | ||
Expr( | ||
StmtExpr { | ||
range: 24..25, | ||
value: Name( | ||
ExprName { | ||
range: 24..25, | ||
id: "x", | ||
ctx: Load, | ||
}, | ||
), | ||
}, | ||
), | ||
Assert( | ||
StmtAssert { | ||
range: 26..40, | ||
test: Yield( | ||
ExprYield { | ||
range: 33..40, | ||
value: Some( | ||
Name( | ||
ExprName { | ||
range: 39..40, | ||
id: "x", | ||
ctx: Load, | ||
}, | ||
), | ||
), | ||
}, | ||
), | ||
msg: None, | ||
}, | ||
), | ||
Assert( | ||
StmtAssert { | ||
range: 41..49, | ||
test: Name( | ||
ExprName { | ||
range: 48..49, | ||
id: "x", | ||
ctx: Load, | ||
}, | ||
), | ||
msg: None, | ||
}, | ||
), | ||
Expr( | ||
StmtExpr { | ||
range: 53..54, | ||
value: NumberLiteral( | ||
ExprNumberLiteral { | ||
range: 53..54, | ||
value: Int( | ||
1, | ||
), | ||
}, | ||
), | ||
}, | ||
), | ||
], | ||
}, | ||
) | ||
``` | ||
## Errors | ||
|
||
| | ||
1 | assert *x | ||
| ^^ Syntax Error: starred expression cannot be used here | ||
2 | assert assert x | ||
3 | assert yield x | ||
| | ||
|
||
|
||
| | ||
1 | assert *x | ||
2 | assert assert x | ||
| ^^^^^^ Syntax Error: Expected an identifier, but found a keyword 'assert' that cannot be used here | ||
3 | assert yield x | ||
4 | assert x := 1 | ||
| | ||
|
||
|
||
| | ||
1 | assert *x | ||
2 | assert assert x | ||
| ^^^^^^^^^^^^^^^ Syntax Error: use `;` to separate simple statements | ||
3 | assert yield x | ||
4 | assert x := 1 | ||
| | ||
|
||
|
||
| | ||
1 | assert *x | ||
2 | assert assert x | ||
3 | assert yield x | ||
| ^^^^^^^ Syntax Error: yield expression cannot be used here | ||
4 | assert x := 1 | ||
| | ||
|
||
|
||
| | ||
2 | assert assert x | ||
3 | assert yield x | ||
4 | assert x := 1 | ||
| ^^ Syntax Error: Expected a statement | ||
| |
Oops, something went wrong.