Skip to content

[ty] Add more tests for renamings#21810

Merged
AlexWaygood merged 2 commits intomainfrom
alex/more-renamings
Dec 5, 2025
Merged

[ty] Add more tests for renamings#21810
AlexWaygood merged 2 commits intomainfrom
alex/more-renamings

Conversation

@AlexWaygood
Copy link
Member

Summary

Following on from #21809, this PR adds a few more renaming test cases: tests for @propertys, @singledispatch-decorated functions, and @singledispatchmethod-decorated methods. The @singledispatch(method)-decorated functions all seem to work great, but we don't do as good a job as Pylance on properties with setters and/or deleters right now. (See the TODOs added in these tests.)

Test Plan

N/A

@AlexWaygood AlexWaygood added the server Related to the LSP server label Dec 5, 2025
@AlexWaygood AlexWaygood requested a review from carljm as a code owner December 5, 2025 12:00
@AlexWaygood AlexWaygood added the testing Related to testing Ruff itself label Dec 5, 2025
@AlexWaygood AlexWaygood added the ty Multi-file analysis & type inference label Dec 5, 2025
@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 5, 2025

Diagnostic diff on typing conformance tests

No changes detected when running ty on typing conformance tests ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 5, 2025

mypy_primer results

Changes were detected when running on open source projects
scikit-build-core (https://github.com/scikit-build/scikit-build-core)
- src/scikit_build_core/_logging.py:153:13: warning[unsupported-base] Unsupported class base with type `<class 'Mapping[str, Style]'> | <class 'Mapping[str, Divergent]'>`
- src/scikit_build_core/build/_pathutil.py:25:38: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str | PathLike[str]`, found `DirEntry[Path]`
- src/scikit_build_core/build/_pathutil.py:27:24: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `str | PathLike[str]`, found `DirEntry[Path]`
- src/scikit_build_core/build/wheel.py:98:20: error[no-matching-overload] No overload of bound method `__init__` matches arguments
- Found 42 diagnostics
+ Found 38 diagnostics

No memory usage changes detected ✅

Comment on lines 1477 to 1488
"mypackage/__init__.py",
r#"
class Foo:
@property
def my_property<CURSOR>(self) -> int:
return 42
"#,
)
.source(
"mypackage/subpkg/__init__.py",
r#"
from mypackage import Foo
Copy link
Member

Choose a reason for hiding this comment

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

You probably copy pasted my tests where I messed this up. Do we need the subpackage complexity here or could we just go with main.py and lib.py?

Copy link
Member Author

Choose a reason for hiding this comment

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

Me? Copy and paste? I'm mortally offended (yes, you're right)

@AlexWaygood AlexWaygood enabled auto-merge (squash) December 5, 2025 12:38
@AlexWaygood AlexWaygood merged commit 71a7a03 into main Dec 5, 2025
40 checks passed
@AlexWaygood AlexWaygood deleted the alex/more-renamings branch December 5, 2025 12:41
dcreager added a commit that referenced this pull request Dec 5, 2025
* origin/main: (41 commits)
  [ty] Carry generic context through when converting class into `Callable` (#21798)
  [ty] Add more tests for renamings (#21810)
  [ty] Minor improvements to `assert_type` diagnostics (#21811)
  [ty] Add some attribute/method renaming test cases (#21809)
  Update mkdocs-material to 9.7.0 (Insiders now free) (#21797)
  Remove unused whitespaces in test cases (#21806)
  [ty] fix panic when instantiating a type variable with invalid constraints (#21663)
  [ty] fix build failure caused by conflicts between #21683 and #21800 (#21802)
  [ty] do nothing with `store_expression_type` if `inner_expression_inference_state` is `Get` (#21718)
  [ty] increase the limit on the number of elements in a non-recursively defined literal union (#21683)
  [ty] normalize typevar bounds/constraints in cycles (#21800)
  [ty] Update completion eval to include modules
  [ty] Add modules to auto-import
  [ty] Add support for module-only import requests
  [ty] Refactor auto-import symbol info
  [ty] Clarify the use of `SymbolKind` in auto-import
  [ty] Redact ranking of completions from e2e LSP tests
  [ty] Tweaks tests to use clearer language
  [ty] Update evaluation results
  [ty] Make auto-import ignore symbols in modules starting with a `_`
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server Related to the LSP server 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