-
Notifications
You must be signed in to change notification settings - Fork 4k
[fix] improve width/height error message to say "positive integer" #13206
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] improve width/height error message to say "positive integer" #13206
Conversation
✅ PR preview is ready!
|
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR improves error message accuracy by updating width/height validation error messages to specify "a positive integer" instead of "an integer", making it clearer that 0 and negative values are not valid.
Key Changes:
- Updated error messages in
StreamlitInvalidWidthError,StreamlitInvalidHeightError, andStreamlitInvalidSizeErrorclasses - Modified 14 test files to use substring matching (
in) instead of exact string matching for error message validation
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lib/streamlit/errors.py | Updated error message text in three exception classes to say "a positive integer (pixels)" instead of "an integer (pixels)" |
| lib/tests/streamlit/spinner_test.py | Updated test assertions to use substring matching and updated expected error message text |
| lib/tests/streamlit/elements/text_test.py | Updated test assertions to use substring matching and updated expected error message text |
| lib/tests/streamlit/elements/radio_test.py | Updated test assertions to use substring matching and updated expected error message text |
| lib/tests/streamlit/elements/pyplot_test.py | Updated test assertions to use substring matching and updated expected error message text |
| lib/tests/streamlit/elements/metric_test.py | Updated test assertions for both height and width validation to use substring matching |
| lib/tests/streamlit/elements/markdown_test.py | Updated test assertions for markdown, caption, and badge functions to use substring matching |
| lib/tests/streamlit/elements/image_test.py | Updated test assertions to use substring matching and updated expected error message text |
| lib/tests/streamlit/elements/html_test.py | Updated test assertions to use substring matching and updated expected error message text |
| lib/tests/streamlit/elements/heading_test.py | Updated test assertions for header, subheader, and title functions to use substring matching |
| lib/tests/streamlit/elements/color_picker_test.py | Updated test assertions to use substring matching and updated expected error message text |
| lib/tests/streamlit/elements/checkbox_test.py | Updated test assertions for both checkbox and toggle functions to use substring matching |
| lib/tests/streamlit/elements/button_group_test.py | Updated test assertions to use substring matching and updated expected error message text |
| lib/tests/streamlit/elements/alert_test.py | Updated test assertions to use substring matching with proper multi-line formatting |
lukasmasuch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Describe your changes
Fixes #12868
Updates the error message for invalid
widthandheightvalues to say "a positive integer" instead of "an integer". This makes the error message more accurate since 0 and negative values are not valid.Before:
After:
Changes
StreamlitInvalidWidthErrorinerrors.pyto say "a positive integer (pixels)"StreamlitInvalidHeightErrorinerrors.pyto say "a positive integer (pixels)"StreamlitInvalidSizeErrorinerrors.pyto say "a positive integer (pixels)"GitHub Issue Link (if applicable)
Closes #12868
Testing Plan
in) to check for the key part of the error message.Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.