Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Number and Float validation errors, allow underscores, add tests. Fix issue #4718 #4784

Merged
merged 6 commits into from
Sep 5, 2024

Conversation

merriam
Copy link
Contributor

@merriam merriam commented Jul 22, 2024

Please review the following checklist.

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

Here are some changes to the Validation routines:

  • Number validator no longer accepts 'nan'.
  • Number regex no longer accepts 'e' as first character of a number.
  • Integers no longer accept scientific notation. That is, "1.23e2" happens to resolve to an integer if first viewed as a float, but cannot be cast with int(value).
  • Integers and floats allow underscores, per the Python standard. That is, "1_000_000" is a valid integer and can be typed in a "integer" type field. "12." cannot be typed or validated.

The tbd on documentation: does this warrant a note in the CHANGELOG.md? Also, I started cleaning up the Input Widet documentation and its worth a different commit.

Copy link
Member

@darrenburns darrenburns left a comment

Choose a reason for hiding this comment

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

LGTM

@merriam Any change which could affect a developer using Textual or an end-user using a Textual app warrants a changelog entry. Since this affects the behaviour of the Input, we'd need a changelog entry for it.

@merriam
Copy link
Contributor Author

merriam commented Aug 7, 2024

Sorry, I hadn't realized it was waiting for CHANGELOG. Anything else needed?

@darrenburns darrenburns merged commit 43dfe08 into Textualize:main Sep 5, 2024
20 checks passed
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.

Integer validator does not work as expected permitting floating point numbers
2 participants