Created
August 24, 2016 16:26
-
-
Save tbielawa/2fdc7fa45d6a5cf6d8d6da9324a12b98 to your computer and use it in GitHub Desktop.
Examples of bitmath 1.3.1 - Unsafe Unit Parsing
This file contains 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
>>> import bitmath | |
>>> parsed = bitmath.parse_string('100k') | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
File "/home/tbielawa/lib/python/bitmath/__init__.py", line 1396, in parse_string | |
raise ValueError("The unit %s is not a valid bitmath unit" % unit) | |
ValueError: The unit k is not a valid bitmath unit | |
>>> parsed = bitmath.parse_string_unsafe('100k') | |
>>> parsed == bitmath.kB(100) | |
True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment