GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add tests for `Final`/`Literal` interaction by srittau · Pull Request #2352 · python/typing

Conversation

@srittau

@srittau srittau commented Aug 31, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

This is my first time changing the conformance tests, did I do it correctly? What does "conformant is required when conformance_automated is 'Fail'" mean?

Also cf. #2351. If that issue and this PR is accepted I would like to add quotes from the (changed) spec to the tests before merging this.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@srittau
Add tests for Final/Literal interaction
d52de49
@carljm

carljm commented Aug 31, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

What does "conformant is required when conformance_automated is 'Fail'" mean?

It means that if the automated conformance fails, it is your responsibility to analyze the nature of the gap for that type checker, and decide whether conformant = 'Fail' or conformant = 'Partial' is more appropriate. In the latter case you should also add a notes field describing the gap in conformance.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

carljm
carljm requested changes Aug 31, 2026
View reviewed changes
Comment thread conformance/tests/qualifiers_final_annotation.py Outdated
# Specification: https://typing.readthedocs.io/en/latest/spec/qualifiers.html#id1

ID1: Final[int] = 1
assert_type(ID1, Literal[int])

@carljm carljm Aug 31, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Literal[int] is not a valid type expression (and thus every type checker correctly errors on it). Same with Literal[float] below.

Did you mean to assert the type is just int? If so, I don't think that's an assertion supported by the spec. https://typing.python.org/en/latest/spec/literal.html#interactions-with-final explicitly says that in this exact scenario, an inference of either int or Literal[1] is fine.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@srittau srittau Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Interesting, another contradiction in the spec.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@srittau
Fix type assertions
4276314
@srittau srittau mentioned this pull request Aug 31, 2026
Finals and Literals: Spec contradiction #2351
Open
srittau added 5 commits August 31, 2026 18:07
@srittau
Reshuffle, fix, comment
b214de4
@srittau
Finagle tests more
c61cb1c
@srittau
Update results
d42d2fd
@srittau
One case is optional per the spec, add another case
5b3a1bb
@srittau
Update results
ae58134
@carljm

carljm commented Aug 31, 2026

Copy link
Copy Markdown
Member

What is your intention for this PR vs #2353 ? I think it would be simpler and preferable to just have one combined PR that modifies both the spec text and the conformance suite, rather than two separate PRs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@srittau srittau added the topic: conformance tests Issues with the conformance test suite label Aug 31, 2026
@srittau

srittau commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

What is your intention for this PR vs #2353 ? I think it would be simpler and preferable to just have one combined PR that modifies both the spec text and the conformance suite, rather than two separate PRs.

Sure, I can combine them if you prefer. Considering that both are more or less independent (since the are only refactorings/documentation of the status quo) I thought it would be easier to review separately.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@carljm

carljm commented Aug 31, 2026

Copy link
Copy Markdown
Member

I don't have strong feelings; if you prefer to separate them, that's fine. I would personally find it easier to review them together; it makes it easier to validate that we have the right tests for the clarified spec text.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@srittau

srittau commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

Will merge when I get home.

carljm reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@srittau srittau closed this Aug 31, 2026
@srittau
srittau deleted the conformance-final branch August 31, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@carljm carljm carljm requested changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

topic: conformance tests Issues with the conformance test suite

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@srittau @carljm
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.