Пример #1
0
    def test_dictmap_funcargs(self):
        test = {'a': 1, 'b': 2, 'c': 3}

        def func(v, increment=1):
            return v + increment

        expected = {'a': 3, 'b': 4, 'c': 5}
        self.assertEqual(expected, utils.dictmap(func, test, increment=2))
Пример #2
0
 def test_dictmap_nofuncargs(self):
     test = {'a': 1, 'b': 2, 'c': 3}
     expected = {'a': 2, 'b': 3, 'c': 4}
     self.assertEqual(expected, utils.dictmap(lambda v: v + 1, test))