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

Method test_group_by_key

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

Source from the content-addressed store, hash-verified

587 self.assert_type(result)
588
589 def test_group_by_key(self):
590 l = [("a", 1), ("a", 2), ("a", 3), ("b", -1), ("b", 1), ("c", 10), ("c", 5)]
591 e = {"a": [1, 2, 3], "b": [-1, 1], "c": [10, 5]}.items()
592 result = self.seq(l).group_by_key()
593 self.assertEqual(result.len(), len(e))
594 for e0, e1 in zip(result, e):
595 self.assertIteratorEqual(e0, e1)
596 self.assert_type(result)
597
598 def test_grouped(self):
599 l = self.seq([1, 2, 3, 4, 5, 6, 7, 8])

Callers

nothing calls this directly

Calls 4

assertIteratorEqualMethod · 0.95
assert_typeMethod · 0.95
group_by_keyMethod · 0.80
lenMethod · 0.80

Tested by

no test coverage detected