MCPcopy Create free account
hub / github.com/EntilZha/PyFunctional / test_reduce_by_key

Method test_reduce_by_key

functional/test/test_functional.py:786–793  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

784 self.assertEqual(result[4], 100)
785
786 def test_reduce_by_key(self):
787 l = [("a", 1), ("a", 2), ("a", 3), ("b", -1), ("b", 1), ("c", 10), ("c", 5)]
788 e = {"a": 6, "b": 0, "c": 15}.items()
789 result = self.seq(l).reduce_by_key(lambda x, y: x + y)
790 self.assertEqual(result.len(), len(e))
791 for e0, e1 in zip(result, e):
792 self.assertEqual(e0, e1)
793 self.assert_type(result)
794
795 def test_count_by_key(self):
796 l = [

Callers

nothing calls this directly

Calls 3

assert_typeMethod · 0.95
reduce_by_keyMethod · 0.80
lenMethod · 0.80

Tested by

no test coverage detected