Skip to content

[ty] Add tests for else branches of hasattr() narrowing #18067

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

Merged
merged 1 commit into from
May 13, 2025

Conversation

AlexWaygood
Copy link
Member

Summary

This addresses @sharkdp's post-merge review in #18053 (comment)

Test Plan

cargo test -p ty_python_semantic

@AlexWaygood AlexWaygood added internal An internal refactor or improvement testing Related to testing Ruff itself ty Multi-file analysis & type inference labels May 13, 2025
Copy link
Contributor

mypy_primer results

Changes were detected when running on open source projects
hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
+ error[type-assertion-failure] tests/annotations/declarations.py:956:5: Argument does not have asserted type `PBuilds[@Todo(Support for `typing.TypeAlias`)] | StdBuilds[@Todo(Support for `typing.TypeAlias`)]`
+ error[type-assertion-failure] tests/annotations/declarations.py:961:5: Argument does not have asserted type `PBuilds[@Todo(Support for `typing.TypeAlias`)] | StdBuilds[@Todo(Support for `typing.TypeAlias`)]`
- Found 647 diagnostics
+ Found 649 diagnostics

@MichaReiser MichaReiser removed the internal An internal refactor or improvement label May 13, 2025
@sharkdp
Copy link
Contributor

sharkdp commented May 13, 2025

Wait, why do we have a mypy_primer diff on this PR? 🤔

Copy link
Contributor

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

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

Thank you!

@AlexWaygood AlexWaygood merged commit 5bf5f36 into main May 13, 2025
34 checks passed
@AlexWaygood AlexWaygood deleted the alex/hasattr-else-test branch May 13, 2025 13:57
@AlexWaygood
Copy link
Member Author

Wait, why do we have a mypy_primer diff on this PR? 🤔

No idea... Those specific hits seem to be showing up on a bunch of PRs right now...

dcreager added a commit that referenced this pull request May 13, 2025
…eep-dish

* origin/main:
  [ty] __file__ is always a string inside a Python module (#18071)
  [ty] Recognize submodules in self-referential imports (#18005)
  [ty] Add a note to the diagnostic if a new builtin is used on an old Python version (#18068)
  [ty] Add tests for `else` branches of `hasattr()` narrowing (#18067)
  [ty] Improve diagnostics for `assert_type` and `assert_never` (#18050)
  [ty] contribution guide (#18061)
  [ty] Implement `DataClassInstance` protocol for dataclasses. (#18018)
  [ruff_python_ast] Fix redundant visitation of test expressions in elif clause statements (#18064)
Glyphack pushed a commit to Glyphack/ruff that referenced this pull request May 21, 2025
…h#18067)

## Summary

This addresses @sharkdp's post-merge review in
astral-sh#18053 (comment)

## Test Plan

`cargo test -p ty_python_semantic`
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 ty Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants