---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/invalid/statements/match/as_pattern_3.py
---
## AST

```
Module(
    ModModule {
        node_index: AtomicNodeIndex(..),
        range: 0..136,
        body: [
            Match(
                StmtMatch {
                    node_index: AtomicNodeIndex(..),
                    range: 0..120,
                    subject: Name(
                        ExprName {
                            node_index: AtomicNodeIndex(..),
                            range: 6..13,
                            id: Name("subject"),
                            ctx: Load,
                        },
                    ),
                    cases: [
                        MatchCase {
                            range: 103..120,
                            node_index: AtomicNodeIndex(..),
                            pattern: MatchClass(
                                PatternMatchClass {
                                    range: 108..117,
                                    node_index: AtomicNodeIndex(..),
                                    cls: Dict(
                                        ExprDict {
                                            node_index: AtomicNodeIndex(..),
                                            range: 108..109,
                                            items: [],
                                        },
                                    ),
                                    arguments: PatternArguments {
                                        range: 109..117,
                                        node_index: AtomicNodeIndex(..),
                                        patterns: [
                                            MatchAs(
                                                PatternMatchAs {
                                                    range: 110..116,
                                                    node_index: AtomicNodeIndex(..),
                                                    pattern: Some(
                                                        MatchAs(
                                                            PatternMatchAs {
                                                                range: 110..111,
                                                                node_index: AtomicNodeIndex(..),
                                                                pattern: None,
                                                                name: Some(
                                                                    Identifier {
                                                                        id: Name("x"),
                                                                        range: 110..111,
                                                                        node_index: AtomicNodeIndex(..),
                                                                    },
                                                                ),
                                                            },
                                                        ),
                                                    ),
                                                    name: Some(
                                                        Identifier {
                                                            id: Name("y"),
                                                            range: 115..116,
                                                            node_index: AtomicNodeIndex(..),
                                                        },
                                                    ),
                                                },
                                            ),
                                        ],
                                        keywords: [],
                                    },
                                },
                            ),
                            guard: None,
                            body: [
                                Expr(
                                    StmtExpr {
                                        node_index: AtomicNodeIndex(..),
                                        range: 119..120,
                                        value: NumberLiteral(
                                            ExprNumberLiteral {
                                                node_index: AtomicNodeIndex(..),
                                                range: 119..120,
                                                value: Int(
                                                    1,
                                                ),
                                            },
                                        ),
                                    },
                                ),
                            ],
                        },
                    ],
                },
            ),
            Pass(
                StmtPass {
                    node_index: AtomicNodeIndex(..),
                    range: 131..135,
                },
            ),
        ],
    },
)
```
## Errors

  |
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 '('
5 |         pass
  |


  |
2 |     #     Not in the mapping start token set, so the list parsing bails
3 |     #     v
4 |     case {(x as y): 1}:
  |          ^ Syntax Error: Invalid value for a class pattern
5 |         pass
  |


  |
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 '}'
5 |         pass
  |


  |
2 |     #     Not in the mapping start token set, so the list parsing bails
3 |     #     v
4 |     case {(x as y): 1}:
  |                       ^ Syntax Error: Expected a statement
5 |         pass
  |


  |
2 |     #     Not in the mapping start token set, so the list parsing bails
3 |     #     v
4 |     case {(x as y): 1}:
  |                        ^ Syntax Error: Expected a statement
5 |         pass
  |


  |
3 |     #     v
4 |     case {(x as y): 1}:
5 |         pass
  | ^^^^^^^^ Syntax Error: Unexpected indentation
  |


  |
4 |     case {(x as y): 1}:
5 |         pass
  |             ^ Syntax Error: Expected a statement
  |
