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