def _check_uniques(self, n, seq): """A set can't hold multiple copies of the same value. If the list only has uniques, it has the same length as the set. """ compositions = itc.permutation_with_replacement(n, seq) self.assertEqual(len(compositions), len(set(compositions)))
def _check_length(self, n, seq): """Makes sure that every sequence has the correct length. """ compositions = itc.permutation_with_replacement(n, seq) for comp in compositions: self.assertEqual(len(comp), n)