示例#1
0
 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)
示例#2
0
    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)
示例#3
0
    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))
示例#4
0
    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))