Skip to content

[red-knot] Improve the style of various mdtests #14839

@AlexWaygood

Description

@AlexWaygood

We have a lot of mdtests in red-knot that have this pattern in them to create instance types:

def bool_instance() -> bool:
    return True

x = bool_instance()

def int_instance() -> int:
    return 42

y = int_instance()

# do some reveal_type calls or whatever in the test now with `x` and `y`

Now that #14802 has landed, however, we don't need nearly as much boilerplate in our tests. Instead, we can do something much more elegant:

def f(x: bool, y: int):
    ...
    # do some reveal_type calls or whatever with `x` and `y`

We should go through all the Python snippets in https://github.com/astral-sh/ruff/tree/main/crates/red_knot_python_semantic/resources/mdtest to reduce the boilerplate in our mdtests.

Metadata

Metadata

Assignees

Labels

help wantedContributions especially welcometestingRelated 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