Repository navigation
Accept None in check_value for optional numeric items - #116
Merged
Merged
Conversation
* [UPDATE] : guidata/dataset/dataitems.py:
- NumericTypeItem.check_value accepts None when allow_none=True
- IntItem.check_value skips the parity check for None
* [ADD] : guidata/tests/unit/test_optional_numeric_check.py:
- test optional int/float items accept None (empty field)
- test non-None values keep min/even constraints
- test required items keep rejecting None
- test DataSetEditLayout accepts empty optional numeric fields
* [UPDATE] : doc/release_notes/release_3.16.md:
- add bug fix entry for empty optional numeric fields
Assisted by : Opus 5.5
There was a problem hiding this comment.
🟡 Changes recommended
Malformed nonempty numeric input now passes optional-field validation and is silently saved as None.
1 open finding
What changed in this PR
Updates guidata’s numeric validation to accept None for optional fields in generated forms.
Changes:
- Accepts optional
Nonevalues before numeric and parity checks. - Adds validation and form regression tests.
- Documents the fix in release notes.
| File | Description |
|---|---|
| guidata/tests/unit/test_optional_numeric_check.py | Tests optional values, constraints, and form validation. |
| guidata/dataset/dataitems.py | Allows None for optional numeric items. |
| doc/release_notes/release_3.16.md | Documents optional-field validation changes. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
* [UPDATE] : guidata/dataset/qtitemwidgets.py:
- add LineEditWidget.parse_text distinguishing empty from malformed text
- use parse_text in check and line_edit_changed
* [UPDATE] : guidata/tests/unit/test_optional_numeric_check.py:
- add test_malformed_optional_numeric_input_is_invalid
- add test_display_callback_ignores_malformed_optional_numeric_input
* [UPDATE] : doc/release_notes/release_3.16.md:
- state that malformed entries remain invalid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

No description provided.