Skip to content

Extremely verbose mdtest output if a revealed type is not what is expected #13708

@AlexWaygood

Description

@AlexWaygood

If you have a # revealed assertion on a line in an mdtest, and the revealed type is not what you are asserting, the output is something like this:

  /src/test.py
    line 16: unmatched assertion: revealed: tuple[Literal[A], Literal[B], Literal[C], Literal[A], Literal[object]]
    line 16: unexpected error: [undefined-reveal] "`reveal_type` used without importing it; this is allowed for debugging convenience but will fail at runtime"
    line 16: unexpected error: [revealed-type] "Revealed type is `tuple[Literal[A], Literal[X], Literal[Y], Literal[O], Literal[object]]`"

Really I only made a single mistake here: the revealed type is not what I asserted it would be. However, for this single mistake, I have to pay the "fine" of three (long) lines of mdtest output!

Metadata

Metadata

Assignees

No one assigned

    Labels

    testingRelated to testing Ruff itselftyMulti-file analysis & type inference

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions