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

Method test_count_by_key

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

Source from the content-addressed store, hash-verified

793 self.assert_type(result)
794
795 def test_count_by_key(self):
796 l = [
797 ("a", 1),
798 ("a", 2),
799 ("a", 3),
800 ("b", -1),
801 ("b", 1),
802 ("c", 10),
803 ("c", 5),
804 ("d", 1),
805 ]
806 e = {"a": 3, "b": 2, "c": 2, "d": 1}.items()
807 result = self.seq(l).count_by_key()
808 self.assertEqual(result.len(), len(e))
809 for e0, e1 in zip(result, e):
810 self.assertEqual(e0, e1)
811 self.assert_type(result)
812
813 def test_count_by_value(self):
814 l = ["a", "a", "a", "b", "b", "c", "d"]

Callers

nothing calls this directly

Calls 3

assert_typeMethod · 0.95
count_by_keyMethod · 0.80
lenMethod · 0.80

Tested by

no test coverage detected