def attribute_group_pairs(self) -> GroupPairs: """ Return all pairs of groups of attribute names e.g. (a, [b, c]), ([a, b], c), ([a, c], b) """ return get_group_pairs(items=self.attribute_names, ordered=False, include_empty=False)
def group_pairs(self, ordered: Optional[bool] = None) -> GroupPairs: """ Return all pairs of groups of answer choices e.g. for (a, b, c) return [(a, [b, c]), ([a, b], c), ([a, c], b)] :param ordered: Whether to return ordered pairs only. If not specified, use the `_ordered` property of the Categorical item. """ ordered = ordered if ordered is not None else self._ordered if ordered: return get_group_pairs(items=self.category_names, ordered=True, include_empty=False) else: return get_group_pairs(items=self.category_names, ordered=False, include_empty=False)
def test_get_ordered_group_pairs_empty(self): self.assertEqual( self.ordered_group_pairs_empty, get_group_pairs(self.groups, ordered=True, include_empty=True))
def test_get_unordered_group_pairs_no_empty(self): self.assertEqual( self.unordered_group_pairs_no_empty, get_group_pairs(self.groups, ordered=False, include_empty=False))