Change in vdsm[master]: itmap unit tests

ybronhei at redhat.com ybronhei at redhat.com
Tue Oct 23 13:23:28 UTC 2012


Yaniv Bronhaim has uploaded a new change for review.

Change subject: itmap unit tests
......................................................................

itmap unit tests

Change-Id: I26e258a035f49a8ecd57e992b9a68b9475a58839
Signed-off-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M tests/miscTests.py
1 file changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/8746/1

diff --git a/tests/miscTests.py b/tests/miscTests.py
index 6339986..ebaeffc 100644
--- a/tests/miscTests.py
+++ b/tests/miscTests.py
@@ -196,6 +196,23 @@
             self.fail("tmap did not throw an exception")
 
 
+class ITMap(TestCaseBase):
+    def testMoreArgsThanThreads(self):
+        def dummy(arg):
+            time.sleep(1)
+            return arg
+        data = [1, 2, 3, 4]
+        self.assertEquals(list(misc.itmap(dummy, data, 3)), data)
+
+    def testMoreThreadsThanArgs(self):
+        data = [1, 2, 3]
+        self.assertEquals(list(misc.itmap(int, data, 80)), data)
+
+    def testInvalidITMapParams(self):
+        data = 1
+        self.assertRaises(Exception, misc.itmap(int, data, 0))
+
+
 class RotateFiles(TestCaseBase):
     def testNonExistingDir(self, persist=False):
         """


--
To view, visit http://gerrit.ovirt.org/8746
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I26e258a035f49a8ecd57e992b9a68b9475a58839
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei at redhat.com>


More information about the vdsm-patches mailing list