---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/valid/expressions/compare.py
---
## AST

```
Module(
    ModModule {
        node_index: AtomicNodeIndex(..),
        range: 0..542,
        body: [
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 9..15,
                    value: Compare(
                        ExprCompare {
                            node_index: AtomicNodeIndex(..),
                            range: 9..15,
                            left: Name(
                                ExprName {
                                    node_index: AtomicNodeIndex(..),
                                    range: 9..10,
                                    id: Name("a"),
                                    ctx: Load,
                                },
                            ),
                            ops: [
                                Eq,
                            ],
                            comparators: [
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 14..15,
                                        id: Name("b"),
                                        ctx: Load,
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 16..21,
                    value: Compare(
                        ExprCompare {
                            node_index: AtomicNodeIndex(..),
                            range: 16..21,
                            left: Name(
                                ExprName {
                                    node_index: AtomicNodeIndex(..),
                                    range: 16..17,
                                    id: Name("b"),
                                    ctx: Load,
                                },
                            ),
                            ops: [
                                Lt,
                            ],
                            comparators: [
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 20..21,
                                        id: Name("a"),
                                        ctx: Load,
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 22..27,
                    value: Compare(
                        ExprCompare {
                            node_index: AtomicNodeIndex(..),
                            range: 22..27,
                            left: Name(
                                ExprName {
                                    node_index: AtomicNodeIndex(..),
                                    range: 22..23,
                                    id: Name("b"),
                                    ctx: Load,
                                },
                            ),
                            ops: [
                                Gt,
                            ],
                            comparators: [
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 26..27,
                                        id: Name("a"),
                                        ctx: Load,
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 28..34,
                    value: Compare(
                        ExprCompare {
                            node_index: AtomicNodeIndex(..),
                            range: 28..34,
                            left: Name(
                                ExprName {
                                    node_index: AtomicNodeIndex(..),
                                    range: 28..29,
                                    id: Name("a"),
                                    ctx: Load,
                                },
                            ),
                            ops: [
                                GtE,
                            ],
                            comparators: [
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 33..34,
                                        id: Name("b"),
                                        ctx: Load,
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 35..41,
                    value: Compare(
                        ExprCompare {
                            node_index: AtomicNodeIndex(..),
                            range: 35..41,
                            left: Name(
                                ExprName {
                                    node_index: AtomicNodeIndex(..),
                                    range: 35..36,
                                    id: Name("a"),
                                    ctx: Load,
                                },
                            ),
                            ops: [
                                LtE,
                            ],
                            comparators: [
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 40..41,
                                        id: Name("b"),
                                        ctx: Load,
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 42..48,
                    value: Compare(
                        ExprCompare {
                            node_index: AtomicNodeIndex(..),
                            range: 42..48,
                            left: Name(
                                ExprName {
                                    node_index: AtomicNodeIndex(..),
                                    range: 42..43,
                                    id: Name("a"),
                                    ctx: Load,
                                },
                            ),
                            ops: [
                                NotEq,
                            ],
                            comparators: [
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 47..48,
                                        id: Name("b"),
                                        ctx: Load,
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 49..55,
                    value: Compare(
                        ExprCompare {
                            node_index: AtomicNodeIndex(..),
                            range: 49..55,
                            left: Name(
                                ExprName {
                                    node_index: AtomicNodeIndex(..),
                                    range: 49..50,
                                    id: Name("a"),
                                    ctx: Load,
                                },
                            ),
                            ops: [
                                Is,
                            ],
                            comparators: [
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 54..55,
                                        id: Name("c"),
                                        ctx: Load,
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 56..62,
                    value: Compare(
                        ExprCompare {
                            node_index: AtomicNodeIndex(..),
                            range: 56..62,
                            left: Name(
                                ExprName {
                                    node_index: AtomicNodeIndex(..),
                                    range: 56..57,
                                    id: Name("a"),
                                    ctx: Load,
                                },
                            ),
                            ops: [
                                In,
                            ],
                            comparators: [
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 61..62,
                                        id: Name("b"),
                                        ctx: Load,
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 63..73,
                    value: Compare(
                        ExprCompare {
                            node_index: AtomicNodeIndex(..),
                            range: 63..73,
                            left: Name(
                                ExprName {
                                    node_index: AtomicNodeIndex(..),
                                    range: 63..64,
                                    id: Name("a"),
                                    ctx: Load,
                                },
                            ),
                            ops: [
                                NotIn,
                            ],
                            comparators: [
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 72..73,
                                        id: Name("c"),
                                        ctx: Load,
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 74..84,
                    value: Compare(
                        ExprCompare {
                            node_index: AtomicNodeIndex(..),
                            range: 74..84,
                            left: Name(
                                ExprName {
                                    node_index: AtomicNodeIndex(..),
                                    range: 74..75,
                                    id: Name("a"),
                                    ctx: Load,
                                },
                            ),
                            ops: [
                                IsNot,
                            ],
                            comparators: [
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 83..84,
                                        id: Name("b"),
                                        ctx: Load,
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 110..156,
                    value: Compare(
                        ExprCompare {
                            node_index: AtomicNodeIndex(..),
                            range: 110..156,
                            left: Name(
                                ExprName {
                                    node_index: AtomicNodeIndex(..),
                                    range: 110..111,
                                    id: Name("a"),
                                    ctx: Load,
                                },
                            ),
                            ops: [
                                NotIn,
                                IsNot,
                                NotIn,
                                NotIn,
                                IsNot,
                            ],
                            comparators: [
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 119..120,
                                        id: Name("b"),
                                        ctx: Load,
                                    },
                                ),
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 128..129,
                                        id: Name("c"),
                                        ctx: Load,
                                    },
                                ),
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 137..138,
                                        id: Name("d"),
                                        ctx: Load,
                                    },
                                ),
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 146..147,
                                        id: Name("e"),
                                        ctx: Load,
                                    },
                                ),
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 155..156,
                                        id: Name("f"),
                                        ctx: Load,
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 177..203,
                    value: Compare(
                        ExprCompare {
                            node_index: AtomicNodeIndex(..),
                            range: 177..203,
                            left: BinOp(
                                ExprBinOp {
                                    node_index: AtomicNodeIndex(..),
                                    range: 177..182,
                                    left: Name(
                                        ExprName {
                                            node_index: AtomicNodeIndex(..),
                                            range: 177..178,
                                            id: Name("a"),
                                            ctx: Load,
                                        },
                                    ),
                                    op: BitOr,
                                    right: Name(
                                        ExprName {
                                            node_index: AtomicNodeIndex(..),
                                            range: 181..182,
                                            id: Name("b"),
                                            ctx: Load,
                                        },
                                    ),
                                },
                            ),
                            ops: [
                                Lt,
                                NotIn,
                            ],
                            comparators: [
                                BinOp(
                                    ExprBinOp {
                                        node_index: AtomicNodeIndex(..),
                                        range: 185..190,
                                        left: Name(
                                            ExprName {
                                                node_index: AtomicNodeIndex(..),
                                                range: 185..186,
                                                id: Name("c"),
                                                ctx: Load,
                                            },
                                        ),
                                        op: BitOr,
                                        right: Name(
                                            ExprName {
                                                node_index: AtomicNodeIndex(..),
                                                range: 189..190,
                                                id: Name("d"),
                                                ctx: Load,
                                            },
                                        ),
                                    },
                                ),
                                BinOp(
                                    ExprBinOp {
                                        node_index: AtomicNodeIndex(..),
                                        range: 198..203,
                                        left: Name(
                                            ExprName {
                                                node_index: AtomicNodeIndex(..),
                                                range: 198..199,
                                                id: Name("e"),
                                                ctx: Load,
                                            },
                                        ),
                                        op: BitAnd,
                                        right: Name(
                                            ExprName {
                                                node_index: AtomicNodeIndex(..),
                                                range: 202..203,
                                                id: Name("f"),
                                                ctx: Load,
                                            },
                                        ),
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 379..393,
                    value: UnaryOp(
                        ExprUnaryOp {
                            node_index: AtomicNodeIndex(..),
                            range: 379..393,
                            op: Not,
                            operand: Compare(
                                ExprCompare {
                                    node_index: AtomicNodeIndex(..),
                                    range: 383..393,
                                    left: Name(
                                        ExprName {
                                            node_index: AtomicNodeIndex(..),
                                            range: 383..384,
                                            id: Name("x"),
                                            ctx: Load,
                                        },
                                    ),
                                    ops: [
                                        NotIn,
                                    ],
                                    comparators: [
                                        Name(
                                            ExprName {
                                                node_index: AtomicNodeIndex(..),
                                                range: 392..393,
                                                id: Name("y"),
                                                ctx: Load,
                                            },
                                        ),
                                    ],
                                },
                            ),
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 395..416,
                    value: BoolOp(
                        ExprBoolOp {
                            node_index: AtomicNodeIndex(..),
                            range: 395..416,
                            op: Or,
                            values: [
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 395..396,
                                        id: Name("x"),
                                        ctx: Load,
                                    },
                                ),
                                BoolOp(
                                    ExprBoolOp {
                                        node_index: AtomicNodeIndex(..),
                                        range: 400..416,
                                        op: And,
                                        values: [
                                            Compare(
                                                ExprCompare {
                                                    node_index: AtomicNodeIndex(..),
                                                    range: 400..410,
                                                    left: Name(
                                                        ExprName {
                                                            node_index: AtomicNodeIndex(..),
                                                            range: 400..401,
                                                            id: Name("y"),
                                                            ctx: Load,
                                                        },
                                                    ),
                                                    ops: [
                                                        NotIn,
                                                    ],
                                                    comparators: [
                                                        Name(
                                                            ExprName {
                                                                node_index: AtomicNodeIndex(..),
                                                                range: 409..410,
                                                                id: Name("z"),
                                                                ctx: Load,
                                                            },
                                                        ),
                                                    ],
                                                },
                                            ),
                                            Name(
                                                ExprName {
                                                    node_index: AtomicNodeIndex(..),
                                                    range: 415..416,
                                                    id: Name("a"),
                                                    ctx: Load,
                                                },
                                            ),
                                        ],
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 417..429,
                    value: Compare(
                        ExprCompare {
                            node_index: AtomicNodeIndex(..),
                            range: 417..429,
                            left: Name(
                                ExprName {
                                    node_index: AtomicNodeIndex(..),
                                    range: 417..418,
                                    id: Name("x"),
                                    ctx: Load,
                                },
                            ),
                            ops: [
                                Eq,
                            ],
                            comparators: [
                                Await(
                                    ExprAwait {
                                        node_index: AtomicNodeIndex(..),
                                        range: 422..429,
                                        value: Name(
                                            ExprName {
                                                node_index: AtomicNodeIndex(..),
                                                range: 428..429,
                                                id: Name("y"),
                                                ctx: Load,
                                            },
                                        ),
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 430..446,
                    value: Compare(
                        ExprCompare {
                            node_index: AtomicNodeIndex(..),
                            range: 430..446,
                            left: Name(
                                ExprName {
                                    node_index: AtomicNodeIndex(..),
                                    range: 430..431,
                                    id: Name("x"),
                                    ctx: Load,
                                },
                            ),
                            ops: [
                                IsNot,
                            ],
                            comparators: [
                                Await(
                                    ExprAwait {
                                        node_index: AtomicNodeIndex(..),
                                        range: 439..446,
                                        value: Name(
                                            ExprName {
                                                node_index: AtomicNodeIndex(..),
                                                range: 445..446,
                                                id: Name("y"),
                                                ctx: Load,
                                            },
                                        ),
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
            Expr(
                StmtExpr {
                    node_index: AtomicNodeIndex(..),
                    range: 489..541,
                    value: Compare(
                        ExprCompare {
                            node_index: AtomicNodeIndex(..),
                            range: 489..541,
                            left: Name(
                                ExprName {
                                    node_index: AtomicNodeIndex(..),
                                    range: 489..490,
                                    id: Name("a"),
                                    ctx: Load,
                                },
                            ),
                            ops: [
                                Lt,
                                Eq,
                                Gt,
                                Is,
                                NotIn,
                                IsNot,
                                LtE,
                                GtE,
                                NotEq,
                            ],
                            comparators: [
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 493..494,
                                        id: Name("b"),
                                        ctx: Load,
                                    },
                                ),
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 498..499,
                                        id: Name("c"),
                                        ctx: Load,
                                    },
                                ),
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 502..503,
                                        id: Name("d"),
                                        ctx: Load,
                                    },
                                ),
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 507..508,
                                        id: Name("e"),
                                        ctx: Load,
                                    },
                                ),
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 516..517,
                                        id: Name("f"),
                                        ctx: Load,
                                    },
                                ),
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 525..526,
                                        id: Name("g"),
                                        ctx: Load,
                                    },
                                ),
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 530..531,
                                        id: Name("h"),
                                        ctx: Load,
                                    },
                                ),
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 535..536,
                                        id: Name("i"),
                                        ctx: Load,
                                    },
                                ),
                                Name(
                                    ExprName {
                                        node_index: AtomicNodeIndex(..),
                                        range: 540..541,
                                        id: Name("j"),
                                        ctx: Load,
                                    },
                                ),
                            ],
                        },
                    ),
                },
            ),
        ],
    },
)
```
