Byte/Bit display abbreviations and base-unit parse_string fixes#114
Merged
Byte/Bit display abbreviations and base-unit parse_string fixes#114
Conversation
Closes #106. In the strict=False path, add explicit checks before the prefix-normalisation step so that lone 'B' -> Byte, lone 'b' -> Bit, and the word forms bit/bits/byte/bytes (case-insensitive) resolve to the correct base type instead of raising ValueError.
Test Coverage Report
|
The base unit display names were the only ones that didn't use
abbreviated form. Byte('Byte'/'Bytes') -> 'B' and Bit('Bit'/'Bits')
-> 'b', consistent with KiB, MiB, kB, etc. Breaking change noted in
NEWS.rst. Five tests updated to expect the new strings.
update Byte/Bit display string examples to B/b
a53f170 to
3472fb9
Compare
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.
Summary
ByteandBitnow display asBandbrespectively, matching the abbreviated style of every other unit. Breaking change; noted in NEWS.rst.parse_string(strict=False)now correctly handles loneB→Byte, loneb→Bit, and word formsbit/bits/byte/bytes(case-insensitive) instead of raisingValueError. Closes parse_string_unsafe() fails to parse strings with Bit or Byte unit #106.