Skip to content

Remove class-object assertion from defaults test - #2343

Merged
JelleZijlstra merged 1 commit into
python:mainfrom
JelleZijlstra:codex/remove-default-class-assertion
Aug 14, 2026
Merged

Remove class-object assertion from defaults test#2343
JelleZijlstra merged 1 commit into
python:mainfrom
JelleZijlstra:codex/remove-default-class-assertion

Conversation

@JelleZijlstra

Copy link
Copy Markdown
Member

#2204 rewrote many defaults tests because type checkers are not required to infer a class expression as having a type[C] type, but the assertion for slice in generics_defaults_referential.py was missed. The same rationale applies here. I simply removed the line because the next line with slice() adequately tests the defaults.

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe the reason why I didn't change this one in #2204 was that we emit assert-type-unspellable-subtype for this one in ty instead of type-assertion-failure (since both the asserted type and the inferred type are fully static types), and we just switch off assert-type-unspellable-subtype when running ty on the conformance suite

@JelleZijlstra

Copy link
Copy Markdown
Member Author

we just switch off assert-type-unspellable-subtype when running ty on the conformance suite

I feel like we shouldn't be doing that, it weakens the assert_type tests. But I guess we can gradually burn down the cases where we need it.

@JelleZijlstra
JelleZijlstra merged commit dcffbae into python:main Aug 14, 2026
5 checks passed
@JelleZijlstra
JelleZijlstra deleted the codex/remove-default-class-assertion branch August 14, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants