def test_other_pull_each_arrays(self): itr = sampling.pull_each([]) self.assertEqual(len(list(itr)), 0) itr = list(sampling.pull_each(['a'])) self.assertEqual(len(itr), 1) itr = list(sampling.pull_each([['a']])) self.assertEqual(len(itr), 1) self.assertEqual(itr[0], (['a'], []))
def test_pull_each(self): data = list(range(10)) itr = sampling.pull_each(data) for (i, rest) in itr: self.assertIn(i, data) self.assertNotIn(i, rest) for n in data: self.assertTrue((n in rest) or n == i)