mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Tighten-up the docs for Counter().
This commit is contained in:
parent
4571f347f9
commit
0a1f7b8f72
2 changed files with 26 additions and 25 deletions
|
@ -448,6 +448,11 @@ class TestCounter(unittest.TestCase):
|
|||
self.assertEqual(dict(Counter(s)), dict(Counter(s).items()))
|
||||
self.assertEqual(set(Counter(s)), set(s))
|
||||
|
||||
def test_invariant_for_the_in_operator(self):
|
||||
c = Counter(a=10, b=-2, c=0)
|
||||
for elem in c:
|
||||
self.assert_(elem in c)
|
||||
|
||||
def test_multiset_operations(self):
|
||||
# Verify that adding a zero counter will strip zeros and negatives
|
||||
c = Counter(a=10, b=-2, c=0) + Counter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue