Add pytest, add basic byte conversion testing

This commit is contained in:
2023-05-12 00:06:18 -05:00
parent 60abf999e0
commit 087656ca0b
4 changed files with 42 additions and 2 deletions

View File

@@ -0,0 +1,12 @@
from phototag.helpers import convert_to_bytes
def test_basic():
assert convert_to_bytes("1 Kb") == 128
assert convert_to_bytes("1Mb") == 1024 ** 2 / 8
assert convert_to_bytes("1 KB") == 1024
assert convert_to_bytes("1 MB") == 1024 ** 2
assert convert_to_bytes("1 KiB") == 1024
assert convert_to_bytes("1TiB") == 1024 ** 4
assert convert_to_bytes("1Tib") == 1024 ** 4 / 8
assert convert_to_bytes("1tib") == 1000 ** 4 / 8