Skip to content

[ty] Add more tests for protocols#20095

Merged
AlexWaygood merged 1 commit intomainfrom
alex/proto-tests
Aug 27, 2025
Merged

[ty] Add more tests for protocols#20095
AlexWaygood merged 1 commit intomainfrom
alex/proto-tests

Conversation

@AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Aug 26, 2025

Summary

This PR adds more tests for protocols. It's split out from other PRs that provide functional changes to make those PRs easier to review.

Included here are:

Test Plan

this pr is all tests


Co-authored-by: Shunsuke Shibayama sbym1346@gmail.com

@AlexWaygood AlexWaygood added the testing Related to testing Ruff itself label Aug 26, 2025
@AlexWaygood AlexWaygood added the ty Multi-file analysis & type inference label Aug 26, 2025
@AlexWaygood AlexWaygood requested a review from dcreager as a code owner August 26, 2025 10:07
Comment on lines -1454 to +1461
# TODO: should pass
static_assert(not is_subtype_of(XSub, HasXProperty)) # error: [static-assert-error]
static_assert(not is_assignable_to(XSub, HasXProperty)) # error: [static-assert-error]
static_assert(not is_subtype_of(XSub, XReadWriteProperty))
static_assert(not is_assignable_to(XSub, XReadWriteProperty))
Copy link
Member Author

Choose a reason for hiding this comment

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

this was a bug in the test: we check assignability of XSub to HasXProperty a few lines above. Here we were meant to be asserting assignability of XSub vs XReadWriteProperty, but there was a copy/paste error in the test

@AlexWaygood AlexWaygood merged commit d71518b into main Aug 27, 2025
37 checks passed
@AlexWaygood AlexWaygood deleted the alex/proto-tests branch August 27, 2025 11:56
carljm added a commit to leandrobbraga/ruff that referenced this pull request Aug 27, 2025
* main:
  [`ruff`] Preserve relative whitespace in multi-line expressions (`RUF033`) (astral-sh#19647)
  [ty] Optimize TDD atom ordering (astral-sh#20098)
  [`airflow`] Extend `AIR311` and `AIR312` rules (astral-sh#20082)
  [ty] Preserve qualifiers when accessing attributes on unions/intersections (astral-sh#20114)
  [ty] Fix the inferred interface of specialized generic protocols (astral-sh#19866)
  [ty] Infer slightly more precise types for comprehensions (astral-sh#20111)
  [ty] Add more tests for protocols (astral-sh#20095)
  [ty] don't eagerly unpack aliases in user-authored unions (astral-sh#20055)
  [`flake8-use-pathlib`] Update links to the table showing the correspondence between `os` and `pathlib` (astral-sh#20103)
  [`flake8-use-pathlib`] Make `PTH100` fix unsafe because it can change behavior (astral-sh#20100)
  [`flake8-use-pathlib`] Delete unused `Rule::OsSymlink` enabled check (astral-sh#20099)
  [ty] Add search paths info to unresolved import diagnostics (astral-sh#20040)
  [`flake8-logging-format`] Add auto-fix for f-string logging calls (`G004`) (astral-sh#19303)
  Add a `ScopeKind` for the `__class__` cell (astral-sh#20048)
  Fix incorrect D413 links in docstrings convention FAQ (astral-sh#20089)
  [ty] Refactor inlay hints structure to use separate parts (astral-sh#20052)
second-ed pushed a commit to second-ed/ruff that referenced this pull request Sep 9, 2025
Co-authored-by: Shunsuke Shibayama <sbym1346@gmail.com>
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.

2 participants