Skip to content

Add conformance tests for Final dataclass fields - #1741

Merged
JelleZijlstra merged 2 commits into
python:mainfrom
carljm:dcfinaltests
May 20, 2024
Merged

JelleZijlstra merged 2 commits into
python:mainfrom
carljm:dcfinaltests

Conversation

@carljm

@carljm carljm commented May 20, 2024 •

Copy link
Copy Markdown
Member

Add conformance tests for the spec changes merged in #1669

None of the tested type checkers support nesting Final within ClassVar in dataclasses yet, so they all fail the automated conformance check. Mypy also requires a Final assignment in a dataclass body to be "initialized" (thus effectively requiring final dataclass fields to have a default). But all support the core behavior of defining a final dataclass field, so I marked them all as Partial.

@erictraut erictraut left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good. One minor comment.

Comment thread conformance/results/mypy/dataclasses_final.toml Outdated
@JelleZijlstra
JelleZijlstra merged commit 2d2e8ee into python:main May 20, 2024
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.

3 participants