Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
AlexWaygood opened this issue Dec 8, 2024 · 1 comment · Fixed by #14884
Closed

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

AlexWaygood opened this issue Dec 8, 2024 · 1 comment · Fixed by #14884
Assignees
Labels
help wanted Contributions especially welcome red-knot Multi-file analysis & type inference testing Related to testing Ruff itself

Comments

@AlexWaygood
Copy link
Member

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.

@AlexWaygood AlexWaygood added help wanted Contributions especially welcome red-knot Multi-file analysis & type inference testing Related to testing Ruff itself labels Dec 8, 2024
@InSyncWithFoo
Copy link
Contributor

I'll take this. PR coming tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Contributions especially welcome red-knot Multi-file analysis & type inference testing Related to testing Ruff itself
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants