ruff/crates/ruff_python_parser/tests/snapshots/valid_syntax@statement__assert.py.snap
2024-11-15 19:31:15 +01:00

335 lines
13 KiB
Text

---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/valid/statement/assert.py
snapshot_kind: text
---
## AST
```
Module(
ModModule {
range: 0..186,
body: [
Assert(
StmtAssert {
range: 0..12,
test: Compare(
ExprCompare {
range: 7..12,
left: NumberLiteral(
ExprNumberLiteral {
range: 7..8,
value: Int(
1,
),
},
),
ops: [
Lt,
],
comparators: [
NumberLiteral(
ExprNumberLiteral {
range: 11..12,
value: Int(
2,
),
},
),
],
},
),
msg: None,
},
),
Assert(
StmtAssert {
range: 13..26,
test: Call(
ExprCall {
range: 20..26,
func: Name(
ExprName {
range: 20..24,
id: Name("call"),
ctx: Load,
},
),
arguments: Arguments {
range: 24..26,
args: [],
keywords: [],
},
},
),
msg: None,
},
),
Assert(
StmtAssert {
range: 27..41,
test: BoolOp(
ExprBoolOp {
range: 34..41,
op: And,
values: [
Name(
ExprName {
range: 34..35,
id: Name("a"),
ctx: Load,
},
),
Name(
ExprName {
range: 40..41,
id: Name("b"),
ctx: Load,
},
),
],
},
),
msg: None,
},
),
Assert(
StmtAssert {
range: 42..60,
test: Lambda(
ExprLambda {
range: 49..60,
parameters: Some(
Parameters {
range: 56..57,
posonlyargs: [],
args: [
ParameterWithDefault {
range: 56..57,
parameter: Parameter {
range: 56..57,
name: Identifier {
id: Name("x"),
range: 56..57,
},
annotation: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
),
body: Name(
ExprName {
range: 59..60,
id: Name("y"),
ctx: Load,
},
),
},
),
msg: None,
},
),
Assert(
StmtAssert {
range: 61..75,
test: Await(
ExprAwait {
range: 68..75,
value: Name(
ExprName {
range: 74..75,
id: Name("x"),
ctx: Load,
},
),
},
),
msg: None,
},
),
Assert(
StmtAssert {
range: 76..99,
test: If(
ExprIf {
range: 83..99,
test: BooleanLiteral(
ExprBooleanLiteral {
range: 88..92,
value: true,
},
),
body: Name(
ExprName {
range: 83..84,
id: Name("x"),
ctx: Load,
},
),
orelse: Name(
ExprName {
range: 98..99,
id: Name("y"),
ctx: Load,
},
),
},
),
msg: None,
},
),
Assert(
StmtAssert {
range: 101..118,
test: Name(
ExprName {
range: 108..109,
id: Name("x"),
ctx: Load,
},
),
msg: Some(
StringLiteral(
ExprStringLiteral {
range: 111..118,
value: StringLiteralValue {
inner: Single(
StringLiteral {
range: 111..118,
value: "error",
flags: StringLiteralFlags {
quote_style: Double,
prefix: Empty,
triple_quoted: false,
},
},
),
},
},
),
),
},
),
Assert(
StmtAssert {
range: 119..140,
test: Name(
ExprName {
range: 126..127,
id: Name("x"),
ctx: Load,
},
),
msg: Some(
Lambda(
ExprLambda {
range: 129..140,
parameters: Some(
Parameters {
range: 136..137,
posonlyargs: [],
args: [
ParameterWithDefault {
range: 136..137,
parameter: Parameter {
range: 136..137,
name: Identifier {
id: Name("x"),
range: 136..137,
},
annotation: None,
},
default: None,
},
],
vararg: None,
kwonlyargs: [],
kwarg: None,
},
),
body: Name(
ExprName {
range: 139..140,
id: Name("y"),
ctx: Load,
},
),
},
),
),
},
),
Assert(
StmtAssert {
range: 141..158,
test: Name(
ExprName {
range: 148..149,
id: Name("x"),
ctx: Load,
},
),
msg: Some(
Await(
ExprAwait {
range: 151..158,
value: Name(
ExprName {
range: 157..158,
id: Name("x"),
ctx: Load,
},
),
},
),
),
},
),
Assert(
StmtAssert {
range: 159..185,
test: Name(
ExprName {
range: 166..167,
id: Name("x"),
ctx: Load,
},
),
msg: Some(
If(
ExprIf {
range: 169..185,
test: BooleanLiteral(
ExprBooleanLiteral {
range: 174..178,
value: true,
},
),
body: Name(
ExprName {
range: 169..170,
id: Name("x"),
ctx: Load,
},
),
orelse: Name(
ExprName {
range: 184..185,
id: Name("y"),
ctx: Load,
},
),
},
),
),
},
),
],
},
)
```