Skip to content

Accept None in check_value for optional numeric items - #116

Merged
ThomasMalletCodra merged 2 commits into
developfrom
fix/optional-numeric-check-value
Oct 15, 2026
Merged

ThomasMalletCodra merged 2 commits into
developfrom
fix/optional-numeric-check-value

Conversation

@ThomasMalletCodra

Copy link
Copy Markdown
Contributor

No description provided.

* [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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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 None values 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.

Comment thread guidata/dataset/dataitems.py
* [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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused changes address the validation issue with regression coverage and no unresolved findings; tests were not executed.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@ThomasMalletCodra
ThomasMalletCodra merged commit 1f3d2f2 into develop Oct 15, 2026
10 checks passed
@PierreRaybaut
PierreRaybaut deleted the fix/optional-numeric-check-value branch October 24, 2026 13:20
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