diff --git a/bauh/commons/util.py b/bauh/commons/util.py index 750895c8..f2d04f95 100644 --- a/bauh/commons/util.py +++ b/bauh/commons/util.py @@ -29,7 +29,7 @@ def deep_update(source: dict, overrides: dict): def size_to_byte(size: Union[float, int, str], unit: str, logger: Optional[Logger] = None) -> Optional[float]: - lower_unit = unit.lower() + lower_unit = unit.strip().lower() if isinstance(size, str): try: diff --git a/tests/common/test_util.py b/tests/common/test_util.py index b91a39e9..ea9c8267 100644 --- a/tests/common/test_util.py +++ b/tests/common/test_util.py @@ -41,4 +41,4 @@ class SizeToByteTest(TestCase): self.assertEqual(6383852471797678, size_to_byte('5.67', 'P')) def test_must_treat_string_sizes_before_converting(self): - self.assertEqual(58675.2, size_to_byte(' 57 , 3 ', 'K')) + self.assertEqual(58675.2, size_to_byte(' 57 , 3 ', ' K '))