def test_empty_lists_num_func_mapper(): nums = [] funs = [p.sum_unique, sum] assert [0, 0] == p.num_func_mapper(nums, funs) nums = [2, 2, 2, 4, 5] funs = [] assert [] == p.num_func_mapper(nums, funs)
def test_empty_lists_num_func_mapper(self): nums = [] funs = [p.sum_without_dups, sum] assert [0, 0] == p.num_func_mapper(nums, funs) nums = [2, 2, 2, 4, 5] funs = [] assert [] == p.num_func_mapper(nums, funs)
def test_empty_lists_num_func_mapper(self): nums = [] funs = [p.sum_unique, sum] self.assertEqual([0, 0], p.num_func_mapper(nums, funs)) nums = [2, 2, 2, 4, 5] funs = [] self.assertEqual([], p.num_func_mapper(nums, funs))
def test_num_func_mapper_2(): def most_occurring(nums): c = collections.Counter(nums) # Returns key in dict with highest value return max(c.items(), key=operator.itemgetter(1))[0] nums = [2, 2, 2, 4, 5, 8, 9] funs = [sum, max, most_occurring] assert [32, 9, 2] == p.num_func_mapper(nums, funs)
def test_num_func_mapper_1(): nums = [2, 2, 2, 4, 5] funs = [p.sum_unique, sum] assert [11, 15] == p.num_func_mapper(nums, funs)
def test_num_func_mapper_1(self): nums = [2, 2, 2, 4, 5] funs = [p.sum_without_dups, sum] assert [11, 15] == p.num_func_mapper(nums, funs)
def test_num_func_mapper_1(self): nums = [2, 2, 2, 4, 5] funs = [p.sum_unique, sum] self.assertEqual([11, 15], p.num_func_mapper(nums, funs))