Use Invalid context when keyword used as identifier

This commit is contained in:
Dhruv Manilawala
2024-11-29 15:36:26 +05:30
parent 246a6df87d
commit 91c712cdb1
13 changed files with 85 additions and 70 deletions

View File

@@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/assert_invalid_test_expr.py
snapshot_kind: text
---
## AST
@@ -36,7 +35,7 @@ Module(
ExprName {
range: 17..23,
id: Name("assert"),
ctx: Load,
ctx: Invalid,
},
),
msg: None,

View File

@@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/aug_assign_stmt_invalid_target.py
snapshot_kind: text
---
## AST
@@ -134,7 +133,7 @@ Module(
ExprName {
range: 41..45,
id: Name("pass"),
ctx: Load,
ctx: Invalid,
},
),
},

View File

@@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/comprehension_missing_for_after_async.py
snapshot_kind: text
---
## AST
@@ -17,7 +16,7 @@ Module(
ExprName {
range: 1..6,
id: Name("async"),
ctx: Load,
ctx: Invalid,
},
),
},

View File

@@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/attribute/multiple_dots.py
snapshot_kind: text
---
## AST
@@ -30,7 +29,7 @@ Module(
id: Name(""),
range: 6..6,
},
ctx: Load,
ctx: Invalid,
},
),
attr: Identifier {
@@ -104,7 +103,7 @@ Module(
id: Name(""),
range: 40..40,
},
ctx: Load,
ctx: Invalid,
},
),
attr: Identifier {

View File

@@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/attribute/no_member.py
snapshot_kind: text
---
## AST
@@ -27,7 +26,7 @@ Module(
id: Name(""),
range: 93..93,
},
ctx: Load,
ctx: Invalid,
},
),
},
@@ -61,7 +60,7 @@ Module(
id: Name(""),
range: 141..141,
},
ctx: Load,
ctx: Invalid,
},
),
},

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
@@ -106,7 +105,7 @@ Module(
ExprName {
range: 126..128,
id: Name("is"),
ctx: Load,
ctx: Invalid,
},
),
},

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
@@ -41,7 +40,7 @@ Module(
ExprName {
range: 130..133,
id: Name("for"),
ctx: Load,
ctx: Invalid,
},
),
},

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_0.py
snapshot_kind: text
---
## AST
@@ -31,7 +30,7 @@ Module(
ExprName {
range: 5..8,
id: Name("def"),
ctx: Load,
ctx: Invalid,
},
),
},
@@ -59,7 +58,7 @@ Module(
ExprName {
range: 20..24,
id: Name("pass"),
ctx: Load,
ctx: Invalid,
},
),
},

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_2.py
snapshot_kind: text
---
## AST
@@ -27,7 +26,7 @@ Module(
ExprName {
range: 68..71,
id: Name("def"),
ctx: Load,
ctx: Invalid,
},
),
},
@@ -58,7 +57,7 @@ Module(
ExprName {
range: 83..87,
id: Name("pass"),
ctx: Load,
ctx: Invalid,
},
),
value: None,

View File

@@ -1,7 +1,6 @@
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/expressions/subscript/unclosed_slice_1.py
snapshot_kind: text
---
## AST
@@ -33,7 +32,7 @@ Module(
ExprName {
range: 6..9,
id: Name("def"),
ctx: Load,
ctx: Invalid,
},
),
),
@@ -68,7 +67,7 @@ Module(
ExprName {
range: 21..25,
id: Name("pass"),
ctx: Load,
ctx: Invalid,
},
),
value: None,