Exemple #1
0
 def test_zipper(self):
     assert ListOperations.zipper([1, 2, 3], [2, 5, 3, 7], ["a", "b", "c"],
                                  fillvalue=None) == [
                                      [1, 2, "a"],
                                      [2, 5, "b"],
                                      [3, 3, "c"],
                                      [None, 7, None],
                                  ]
Exemple #2
0
 def test_has_duplicates(self, array, result):
     assert ListOperations.has_duplicates(array) is result
Exemple #3
0
 def test_groupby(self, array, func, result):
     assert ListOperations.group_by(array, func) == result
Exemple #4
0
 def test_all_unique_fails(self, args, error):
     with pytest.raises(error):
         ListOperations.all_unique(args)
Exemple #5
0
 def test_union_by_fails(self, array1, array2, func, error):
     with pytest.raises(error):
         ListOperations.union_by(array1, array2, func)
Exemple #6
0
 def test_symmetric_difference_by_fails(self, array1, array2, func, error):
     with pytest.raises(error):
         ListOperations.symmetric_difference_by(array1, array2, func)
Exemple #7
0
 def test_spread(self, array, result):
     assert ListOperations.spread(array) == result
Exemple #8
0
 def test_sanitize(self, input_list, result):
     assert ListOperations.sanitize_list(input_list) == result
Exemple #9
0
 def test_chunk_list(self, array, size, result):
     assert ListOperations.chunk_list(array, size) == result
Exemple #10
0
 def test_bifurcate_by(self, inputs, func, results):
     assert ListOperations.bifurcate_by(inputs, func) == results
Exemple #11
0
 def test_bifurcate_fails(self, inputs, filters, error):
     with pytest.raises(error):
         ListOperations.bifurcate(inputs, filters)
Exemple #12
0
 def test_bifurcate(self, inputs, filters, results):
     assert ListOperations.bifurcate(inputs, filters) == results
Exemple #13
0
 def test_average_by_fails(self, inputs, error):
     with pytest.raises(error):
         ListOperations.average_by(inputs)
Exemple #14
0
 def test_average_by(self, inputs, function, result):
     assert ListOperations.average_by(sequence=inputs,
                                      function=function) == result
Exemple #15
0
 def test_has_duplicates_fails(self, array, error):
     with pytest.raises(error):
         ListOperations.has_duplicates(array)
Exemple #16
0
 def test_sample(self, args):
     assert ListOperations.sample(args) in args
Exemple #17
0
 def test_chunk_list_fails(self, array, size, error):
     with pytest.raises(error):
         ListOperations.chunk_list(array, size)
Exemple #18
0
 def test_shuffle_list(self, array):
     shuffled = ListOperations.shuffle(array)
     assert shuffled != array and set(shuffled) == set(array)
Exemple #19
0
 def test_deep_flatten(self, args, result):
     assert ListOperations.deep_flatten(args) == result
Exemple #20
0
 def test_symmetric_difference_by(self, array1, array2, func, result):
     assert ListOperations.symmetric_difference_by(array1, array2,
                                                   func) == result
Exemple #21
0
 def test_eval_some(self, array, func, result):
     assert ListOperations.eval_some(array, func) is result
Exemple #22
0
 def test_union_by(self, array1, array2, func, result):
     assert ListOperations.union_by(array1, array2, func) == result
Exemple #23
0
 def test_get_indices(self, element, array, result):
     assert ListOperations.get_indices(element, array) == result
Exemple #24
0
 def test_get_indices_fails(self, element, array, error):
     with pytest.raises(error):
         ListOperations.get_indices(element, array)
Exemple #25
0
 def test_all_unique(self, args, result):
     assert ListOperations.all_unique(args) is result