bpo-25478: Add total() method to collections.Counter (GH-25829)
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 2ba1a19..f98048b 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -2066,6 +2066,10 @@ def test_init(self):
self.assertRaises(TypeError, Counter, (), ())
self.assertRaises(TypeError, Counter.__init__)
+ def test_total(self):
+ c = Counter(a=10, b=5, c=0)
+ self.assertEqual(c.total(), 15)
+
def test_order_preservation(self):
# Input order dictates items() order
self.assertEqual(list(Counter('abracadabra').items()),