kiwi-el8/test/unit/utils_size_test.py
David Cassany 1ed7dc57f5 Add test for the utils class StringToSize
This commit adds a couple of unit tests for the StringToSize class.
2018-04-24 15:33:18 +02:00

18 lines
509 B
Python

from .test_helper import raises
from kiwi.utils.size import StringToSize
from kiwi.exceptions import KiwiSizeError
class TestStringToSize(object):
def test_to_bytes(self):
assert StringToSize.to_bytes('1m') == 1048576
assert StringToSize.to_bytes('1M') == 1048576
assert StringToSize.to_bytes('1g') == 1073741824
assert StringToSize.to_bytes('1G') == 1073741824
@raises(KiwiSizeError)
def test_to_bytes_wrong_format(self):
StringToSize.to_bytes('1mb')