Skip to content

Comments

[ty] Add failing tests for tuple subclasses#19803

Merged
AlexWaygood merged 2 commits intomainfrom
alex/tuple-subclass-tests
Aug 7, 2025
Merged

[ty] Add failing tests for tuple subclasses#19803
AlexWaygood merged 2 commits intomainfrom
alex/tuple-subclass-tests

Conversation

@AlexWaygood
Copy link
Member

Summary

This PR adds tests for tuple subclasses. The tests nearly all fail for now (there are many TODO comments added!) but #19669 makes them pass.

I'm extracting the tests into a standalone PR to make #19669 easier to review.

Test Plan

cargo test -p ty_python_semantic

@AlexWaygood AlexWaygood added testing Related to testing Ruff itself ty Multi-file analysis & type inference labels Aug 7, 2025

```toml
[environment]
python-version = "3.11"
Copy link
Member

Choose a reason for hiding this comment

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

Out of curiosity, which part needs 3.11?

Copy link
Member Author

@AlexWaygood AlexWaygood Aug 7, 2025

Choose a reason for hiding this comment

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

t2: tuple[int, *tuple[str, ...]] is invalid syntax on Python <=3.10 -- starred elements are never allowed in annotations on older versions of Python. On Python <=3.10, you would have to use t1: tuple[int, Unpack[tuple[str, ...]]] (because there's no backwards compatibility problem that can't be solved with more "bracketese"!!) to express this type, but we don't support Unpack yet

Copy link
Member

Choose a reason for hiding this comment

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

Starred tuples, yes! That paged out of my memory quickly 😬

@AlexWaygood AlexWaygood enabled auto-merge (squash) August 7, 2025 13:09
@AlexWaygood AlexWaygood merged commit c401a6d into main Aug 7, 2025
34 checks passed
@AlexWaygood AlexWaygood deleted the alex/tuple-subclass-tests branch August 7, 2025 13:11
dcreager added a commit that referenced this pull request Aug 7, 2025
* main:
  Update Rust toolchain to 1.89 (#19807)
  [ty] Add `ty.inlayHints.variableTypes` server option (#19780)
  [ty] Add failing tests for tuple subclasses (#19803)
  [ty] Add `ty.experimental.rename` server setting (#19800)
dcreager added a commit that referenced this pull request Aug 7, 2025
* dcreager/bound-typevar: (24 commits)
  more comment fix
  this isn't true anymore
  fix inner function in overload implementation ecosystem error
  Update Rust toolchain to 1.89 (#19807)
  [ty] Add `ty.inlayHints.variableTypes` server option (#19780)
  synthetic typevars for type materializations are bound
  [ty] Add failing tests for tuple subclasses (#19803)
  [ty] Add `ty.experimental.rename` server setting (#19800)
  clippy
  make BoundTypeVarInstance interned
  [ty] Implemented support for "rename" language server feature (#19551)
  [ty] Reduce size of member table (#19572)
  [ty] Move server capabilities creation (#19798)
  separate types!
  tmp
  allow KnownInstance::TypeVar in type expressions
  bind typevar in Generic/Protocol base class reference
  [ty] Repurpose `FunctionType.into_bound_method_type` to return `BoundMethodType` (#19793)
  remove unneeded GenericContext::with_binding_context
  create KnownInstanceType::TypeVar for PEP 695 too
  ...
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