Skip to content

[WebTest] Select.value can return None - #16948

Open
Asimmimx wants to merge 1 commit into
python:mainfrom
Asimmimx:webtest-select-value-none
Open

Asimmimx wants to merge 1 commit into
python:mainfrom
Asimmimx:webtest-select-value-none

Conversation

@Asimmimx

@Asimmimx Asimmimx commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Select.value is annotated as str, but it returns None for a <select> without options, and Radio (which inherits the annotation) returns None when no radio button in the group is checked. This changes Select.value__get / Select.value to return str | None.

Upstream: Select.value__get, Radio.value__get

Prepared with AI assistance (Claude Code).

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@srittau

srittau commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Maybe it would be safer to also annotate the return types of Field.value__get/Field.value also with None? This would prevent the LSP violation and need for the # type: ignores.

This branch has not been deployed

No deployments
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