| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Expand Up | @@ -138,6 +138,19 @@ def test_naturaldelta(test_input: float | dt.timedelta, expected: str) -> None: | |||||||||||||||||||||||
| assert humanize.naturaldelta(-test_input) == expected | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def test_naturaldelta_non_finite() -> None: | ||||||||||||||||||||||||
| """Non-finite floats are returned unchanged instead of raising (#333).""" | ||||||||||||||||||||||||
| assert humanize.naturaldelta(float("nan")) == "nan" | ||||||||||||||||||||||||
| assert humanize.naturaldelta(float("inf")) == "inf" | ||||||||||||||||||||||||
| assert humanize.naturaldelta(float("-inf")) == "-inf" | ||||||||||||||||||||||||
|
Comment thread
Comment on lines
+141
to
+145
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityLet's parameterise:
Suggested change
Sorry, something went wrong.
All reactions
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def test_naturaldelta_too_large_value_raises() -> None: | ||||||||||||||||||||||||
| """A too-large *finite* value still raises OverflowError (unlike inf).""" | ||||||||||||||||||||||||
| with pytest.raises(OverflowError): | ||||||||||||||||||||||||
| humanize.naturaldelta(1e30) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @freeze_time(FROZEN_DATE) | ||||||||||||||||||||||||
| @pytest.mark.parametrize( | ||||||||||||||||||||||||
| "test_input, expected", | ||||||||||||||||||||||||
| Expand Down | ||||||||||||||||||||||||
| Back | FazBrowse Home | New Git URL |
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityLet's defer this so it's not imported if not needed.
Please move it inside the except OverflowError: block.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.