From 750022e03df3e33f7cb429665173541085c972dd Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Fri, 1 Oct 2010 17:09:12 +0200 Subject: [PATCH] Add simple unittest for utils.CommaJoin Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- test/ganeti.utils_unittest.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/ganeti.utils_unittest.py b/test/ganeti.utils_unittest.py index df5ef2026..5a70af2a6 100755 --- a/test/ganeti.utils_unittest.py +++ b/test/ganeti.utils_unittest.py @@ -2314,5 +2314,15 @@ class TestShellWriter(unittest.TestCase): self.assertEqual(buf.getvalue(), "") +class TestCommaJoin(unittest.TestCase): + def test(self): + self.assertEqual(utils.CommaJoin([]), "") + self.assertEqual(utils.CommaJoin([1, 2, 3]), "1, 2, 3") + self.assertEqual(utils.CommaJoin(["Hello"]), "Hello") + self.assertEqual(utils.CommaJoin(["Hello", "World"]), "Hello, World") + self.assertEqual(utils.CommaJoin(["Hello", "World", 99]), + "Hello, World, 99") + + if __name__ == '__main__': testutils.GanetiTestProgram() -- GitLab