diff options
author | Dan Bungert <[email protected]> | 2024-02-28 16:15:32 -0700 |
---|---|---|
committer | Dan Bungert <[email protected]> | 2024-02-29 13:07:23 -0700 |
commit | c3c4f42862b01e76ef6767e66b808707897aa558 (patch) | |
tree | f12fa4c11fbae6b2d291d610d0eb30cc1f0ec924 | |
parent | 3d431ba94d9d6c59ac69e3ec53de0f250c5d2aae (diff) |
util: human2bytes actually return int
-rw-r--r-- | curtin/util.py | 2 | ||||
-rw-r--r-- | tests/unittests/test_util.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/curtin/util.py b/curtin/util.py index 53e2035c..3249d1f0 100644 --- a/curtin/util.py +++ b/curtin/util.py @@ -1136,7 +1136,7 @@ def human2bytes(size): if int(val) != val: raise ValueError("'%s': resulted in non-integer (%s)" % (size_in, val)) - return val + return int(val) def bytes2human(size): diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py index 4e268f05..7812b09d 100644 --- a/tests/unittests/test_util.py +++ b/tests/unittests/test_util.py @@ -426,6 +426,9 @@ class TestHuman2Bytes(CiTestCase): GB = 1024 * 1024 * 1024 MB = 1024 * 1024 + def test_actually_an_int(self): + self.assertIsInstance(util.human2bytes("1M"), int) + def test_float_equal_int_is_allowed(self): self.assertEqual(1000, util.human2bytes(1000.0)) |