Repository navigation
Fix #524: return non-finite floats unchanged from naturaltime() and precisedelta() - #525
Open
tony1233200 wants to merge 1 commit into
Open
tony1233200 wants to merge 1 commit into
tony1233200 wants to merge 1 commit into
Conversation
…raltime() and precisedelta() Mirror the naturaldelta() handling from python-humanize#334 in the shared _date_and_delta() helper: non-finite floats (inf/-inf) are returned unchanged as their string instead of raising OverflowError, while a too-large finite value still raises. nan already behaved this way via the ValueError path.
Mixed activityActivity patterns show a mix of organic and automated signals. Evidence
Last 5 PRs: This is an automated analysis by AgentScan |
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.
naturaltime(float("inf"))andprecisedelta(float("inf"))raisedOverflowError, whilenaturaldelta()returns"inf"since #334. This mirrors that handling in the shared_date_and_delta()helper: non-finite floats (inf/-inf) are now returned unchanged as their string, likenanalready was. A too-large finite value (e.g.1e30) still raisesOverflowError, per the documented contract.Tests: added
test_naturaltime_non_finite,test_naturaltime_too_large_value_raises,test_precisedelta_non_finite,test_precisedelta_too_large_value_raises, plus assertions intest_date_and_deltafor both the rounded and precise paths.tests/test_time.py: 403 passed; full suite: 755 passed.