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

Extend test cases for flake8-pyi #14280

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sbrugman
Copy link
Contributor

Summary

This PR extends the test cases for a couple of flake8-pyi rules with nested and mixed union annotations.
Although these are rare, they are valid:

>>> from typing import Union
>>> Union[int | int | float]
typing.Union[int, float]

>>> Union[Union[float, complex]]
typing.Union[float, complex]

We should be able to handle them anyhow, as users or fixes might write these accidentally.

Test Plan

The snapshots are updated with the as-is behaviour.
I'll follow up with a change to the nested union logic. Having these tests in place before makes it easier to review the diff.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has merge conflicts; could you take a look?

@sbrugman
Copy link
Contributor Author

I'll do it in one go after #14270, #14272 and #14273 are merged to avoid duplicate work.

@MichaReiser MichaReiser added internal An internal refactor or improvement testing Related to testing Ruff itself and removed internal An internal refactor or improvement labels Nov 11, 2024
@sbrugman sbrugman marked this pull request as draft November 12, 2024 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Related to testing Ruff itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants