def test_other_hunk_sizes(self): data = [(['a', 'f'], 'o'), (['b', 'g'], 'm'), (['a', 'g'], 'm'), (['a', 'g'], 'o')] hunks = sampling.hunk(data, 0) self.assertEqual(len(hunks), 1) hunks = sampling.hunk(data, -1) self.assertEqual(len(hunks), 4) hunks = sampling.hunk(data, 3) for hunk in hunks: for row in hunk: data.remove(row) self.assertEqual(len(data), 0)
def test_hunk_data(self): data = [(['a', 'f'], 'o'), (['b', 'g'], 'm'), (['a', 'g'], 'm'), (['a', 'g'], 'o'), (['a', 'g'], 'p'), (['g', 'a'], 'n')] hunks = sampling.hunk(data, 3) for hunk in hunks: self.assertEqual(len(hunk), 2) for row in hunk: data.remove(row) self.assertEqual(len(data), 0)