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