Skip to content

Extend test cases for flake8-pyi#14280

Merged
MichaReiser merged 1 commit intoastral-sh:mainfrom
sbrugman:pyi-test-cases
Nov 26, 2024
Merged

Extend test cases for flake8-pyi#14280
MichaReiser merged 1 commit intoastral-sh:mainfrom
sbrugman:pyi-test-cases

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
@sbrugman sbrugman marked this pull request as ready for review November 25, 2024 22:51
@github-actions
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

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