def test_pandas_rows(self): all_rows = [row for idx, row in self.df.iterrows()] res = dopa.parallelize(all_rows, func6) self.assertEqual(len(res), len(self.df)) self.assertListEqual(sorted(res), [5,7,9])
def test_array_arg_thread(self): res = dopa.parallelize(self.arraylist_single, func4) res = np.array(res)[0] # dopa.parallelize return a list self.assertIsNone(np.testing.assert_almost_equal(res, np.array([[2,3,4],[5,6,7]])))
def test_path_fnames(self): tmpdir = './' content = [os.path.join(tmpdir, f) for f in os.listdir(tmpdir)] fnames = [f for f in content if os.path.isfile(f)] res = dopa.parallelize(fnames, func5) self.assertEqual(len(res), len(fnames))
def test_multiple_arg_kwarg(self): res = dopa.parallelize(self.kw, func3) self.assertEqual(set(res), {3, 15})
def test_multiple_arg_process(self): res = dopa.parallelize(self.multi, func2, use_threads=False) self.assertEqual(set(res), {6, 15})
def test_multiple_arg_thread(self): res = dopa.parallelize(self.multi, func2) self.assertEqual(set(res), {6, 15})
def test_single_arg_process(self): res = dopa.parallelize(self.singlearg, func1, use_threads=False) self.assertEqual(set(res), {2, 3, 4})
def test_single_arg_thread(self): res = dopa.parallelize(self.singlearg, func1) self.assertEqual(set(res), {2, 3, 4})