Exemplo n.º 1
0
    def test_dict_iter_of_integers(self):
        iterable = Result({'a': 2, 'b': 3}, dict)

        function = lambda x, y: x + y
        result = _reduce_data(function, iterable)

        self.assertIsInstance(result, Result)
        self.assertEqual(result.evaluation_type, dict)
        self.assertEqual(result.fetch(), {'a': 2, 'b': 3})
Exemplo n.º 2
0
 def test_single_integer(self):
     function = lambda x, y: x + y
     result = _reduce_data(function, 3)
     self.assertEqual(result, 3)
Exemplo n.º 3
0
 def test_single_string(self):
     function = lambda x, y: x + y
     result = _reduce_data(function, 'abc')
     self.assertEqual(result, 'abc')
Exemplo n.º 4
0
    def test_list_iter(self):
        iterable = Result([1, 2, 3], list)

        function = lambda x, y: x + y
        result = _reduce_data(function, iterable)
        self.assertEqual(result, 6)