def test_results_order(self): def func(x): time.sleep(x) return x values = tuple(random.random() * 0.1 for x in range(10)) results = concurrent.tmap(func, values) expected = [concurrent.Result(True, x) for x in values] self.assertEqual(results, expected)
def test_error(self): error = RuntimeError("No result for you!") def func(x): raise error results = concurrent.tmap(func, range(10)) expected = [concurrent.Result(False, error)] * 10 self.assertEqual(results, expected)
def test_results(self): values = tuple(range(10)) results = concurrent.tmap(lambda x: x, values) expected = [concurrent.Result(True, x) for x in values] self.assertEqual(results, expected)