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