Exemple #1
0
 def label_set_permutate(self) -> List[Tuple[str, ...]]:
     """
     Returns a list of label sets, where each label set is a tuple of strings
     """
     check.list_t(self.label_set, str)
     return utils.flatten([
         self._label_str_permutate(label_str)
         for label_str in self.label_set
     ], 1)
Exemple #2
0
 def it_flattens_two_levels():
     f = flatten([[1, 2, [3, 4, [5, 6]]], [7]], depth=2)
     assert f == [1, 2, 3, 4, [5, 6], 7]
Exemple #3
0
 def it_flattens_one_level():
     f = flatten([[1, 2, [3, 4, [5, 6]]], [7]], depth=1)
     assert f == [1, 2, [3, 4, [5, 6]], 7]
Exemple #4
0
 def it_flattens_a_tuples():
     assert flatten([[1, 2], [3, 4, (5, 6)]]) == [1, 2, 3, 4, 5, 6]
Exemple #5
0
 def it_flattens_all_levels():
     f = flatten([[1, 2, [3, 4, [5, 6]]]])
     assert f == [1, 2, 3, 4, 5, 6]
Exemple #6
0
 def it_flattens_a_multilevel_list():
     assert flatten([[1, 2], [3, 4, [5, "abc"]]]) == [1, 2, 3, 4, 5, "abc"]
Exemple #7
0
 def label_set_permutate(self):
     check.list_t(self.label_set, str)
     return utils.flatten([
         self._label_str_permutate(label_str)
         for label_str in self.label_set
     ], 1)