]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume test verify strings with a comma can be converted to ints
authorAlfredo Deza <adeza@redhat.com>
Fri, 21 Dec 2018 20:26:39 +0000 (15:26 -0500)
committerAlfredo Deza <adeza@redhat.com>
Thu, 3 Jan 2019 18:45:01 +0000 (13:45 -0500)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 818902e568adaefecc6da9afee58b3a804a0e4d0)

src/ceph-volume/ceph_volume/tests/util/test_util.py

index 82f2ef27f647148dc9fb8cf72f41da46a995c7a1..edea219fdad915e7a55d3b53c5e135a81b53e3b4 100644 (file)
@@ -15,6 +15,14 @@ class TestAsBytes(object):
 
 class TestStrToInt(object):
 
+    def test_passing_a_float_str_comma(self):
+        result = util.str_to_int("1,99")
+        assert result == 1
+
+    def test_passing_a_float_does_not_round_comma(self):
+        result = util.str_to_int("1,99", round_down=False)
+        assert result == 2
+
     def test_passing_a_float_str(self):
         result = util.str_to_int("1.99")
         assert result == 1