-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
Expected behaviour
I was expecting parse_string_unsafe() to parse all of the following units, but at the very least the ones that parse_string() can parse:
- b
- bit
- Bit
- bits
- Bits
- B
- byte
- Byte
- bytes
- Bytes
Actual behaviour
parse_string_unsafe() fails for all strings consisting of a number and any of the above units:
parse_string_unsafe("1 b")
Results in an error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Python\Lib\site-packages\bitmath\__init__.py", line 1552, in parse_string_unsafe
raise ValueError("The unit %s is not a valid bitmath unit" % unit)
ValueError: The unit B is not a valid bitmath unit
Similarly:
parse_string_unsafe("1 Byte")
Produces:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Python\Lib\site-packages\bitmath\__init__.py", line 1552, in parse_string_unsafe
raise ValueError("The unit %s is not a valid bitmath unit" % unit)
ValueError: The unit ByteB is not a valid bitmath unit
The other units listed behave in the same way.
Versions
- bitmath: 1.3.3.1 (PyPi)
- Windows 10
- Python 3.12.1
Metadata
Metadata
Assignees
Labels
No labels