Skip to content

Simple valid empty fix#5891

Closed
holdenweb wants to merge 2 commits into
Textualize:mainfrom
holdenweb:simple-valid-empty-fix
Closed

Simple valid empty fix#5891
holdenweb wants to merge 2 commits into
Textualize:mainfrom
holdenweb:simple-valid-empty-fix

Conversation

@holdenweb

Copy link
Copy Markdown
Contributor

Please review the following checklist.

  • [n/a] Docstrings on all new or modified functions / classes
  • [n/a] Updated documentation
  • [?] Updated CHANGELOG.md (where appropriate)

This PR fixes the error that validates an empty input with no validators as valid even though valid_empty is False.

The new test at tests/input/test_input_validation.py::test_valid_empty
failed until the sequence of operations in the Input.validate
function was refactored. Existing test continue to pass.

if self.valid_empty and not value:
# If no validators are supplied, and therefore no validation occurs, we return None.
if not self.validators:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since we here have two conditions with the same action, would it overcomplicate the code to elide them? At present I suspect the sequence improves readability.

@holdenweb holdenweb closed this Jun 25, 2025
@holdenweb holdenweb deleted the simple-valid-empty-fix branch June 26, 2025 10:39
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.

1 participant