| 74 | self.assertEqual(parent.get_counts(), counter.get_counts()) |
| 75 | |
| 76 | def test_shared_counts(self): |
| 77 | # Two counters with shared parent should share counts (modulo namespacing). |
| 78 | parent = counting.Counter() |
| 79 | child1 = counting.Counter(parent, 'child1') |
| 80 | child2 = counting.Counter(parent, 'child2') |
| 81 | child1.increment(foo=1) |
| 82 | result = child2.increment(foo=2) |
| 83 | expected = {'child1_foo': 1, 'child2_foo': 2} |
| 84 | self.assertEqual(result, expected) |
| 85 | |
| 86 | def test_return_only_prefixed(self): |
| 87 | parent = counting.Counter() |