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 rollover from ZB to 1.0 YB #206

Merged
merged 5 commits into from
Oct 1, 2024
Merged

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Sep 29, 2024

Fixes #205.

Avoid the conversion to float where possible.

Python 3.13.0rc2 (v3.13.0rc2:ec610069637, Sep  6 2024, 17:57:29) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from humanize import filesize
>>> filesize.naturalsize(100_000_000_000_000_000_000_000)
'100.0 ZB'
>>> filesize.naturalsize(1_000_000_000_000_000_000_000_000)
'1.0 YB'
>>> filesize.naturalsize(10_000_000_000_000_000_000_000_000)
'10.0 YB'
>>> filesize.naturalsize(1_000_000_000_000_000_050_331_648)
'1.0 YB'
>>> filesize.naturalsize(1_000_000_000_000_000_050_331_649)
'1.0 YB'

@asmacdo
Copy link

asmacdo commented Sep 29, 2024

Looks good to me, thanks!

@hugovk hugovk changed the title Add passing test cases Fix rollover from ZB to 1.0 YB Sep 30, 2024
@hugovk hugovk merged commit 56b4fa8 into python-humanize:main Oct 1, 2024
25 checks passed
@hugovk hugovk deleted the fix-1-YB branch October 1, 2024 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: Fixed For any bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Decimal filesize YB to ZB rollover doesn't happen where expected
2 participants