21 lines
429 B
Python
21 lines
429 B
Python
|
import pytest
|
||
|
from humansize import approximate_size
|
||
|
|
||
|
|
||
|
def test_1000():
|
||
|
assert approximate_size(1000000000000, False) == "1.0 TB"
|
||
|
|
||
|
|
||
|
def test_1024():
|
||
|
assert approximate_size(1000000000000) == "931.3 GiB"
|
||
|
|
||
|
|
||
|
def test_negative():
|
||
|
with pytest.raises(ValueError):
|
||
|
approximate_size(-1)
|
||
|
|
||
|
|
||
|
def test_huge_number():
|
||
|
with pytest.raises(ValueError):
|
||
|
approximate_size(1_000_000_000_000_000_000_000_000_000_000)
|