mirror of
https://github.com/ceph/ceph
synced 2025-01-20 01:51:34 +00:00
ceph-volume tests verify str_to_int utility
Signed-off-by: Alfredo Deza <adeza@redhat.com>
This commit is contained in:
parent
99e034d7ee
commit
56b1bf633d
18
src/ceph-volume/ceph_volume/tests/util/test_util.py
Normal file
18
src/ceph-volume/ceph_volume/tests/util/test_util.py
Normal file
@ -0,0 +1,18 @@
|
||||
import pytest
|
||||
from ceph_volume import util
|
||||
|
||||
|
||||
class TestStrToInt(object):
|
||||
|
||||
def test_passing_a_float_str(self):
|
||||
result = util.str_to_int("1.99")
|
||||
assert result == 1
|
||||
|
||||
def test_passing_a_float_does_not_round(self):
|
||||
result = util.str_to_int("1.99", round_down=False)
|
||||
assert result == 2
|
||||
|
||||
def test_text_is_not_an_integer_like(self):
|
||||
with pytest.raises(RuntimeError) as error:
|
||||
util.str_to_int("1.4GB")
|
||||
assert str(error.value) == "Unable to convert to integer: '1.4GB'"
|
Loading…
Reference in New Issue
Block a user