MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_helper_function

Method test_helper_function

Lib/test/test_collections.py:2354–2373  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2352 self.assertIn("'b': None", r)
2353
2354 def test_helper_function(self):
2355 # two paths, one for real dicts and one for other mappings
2356 elems = list('abracadabra')
2357
2358 d = dict()
2359 _count_elements(d, elems)
2360 self.assertEqual(d, {'a': 5, 'r': 2, 'b': 2, 'c': 1, 'd': 1})
2361
2362 m = OrderedDict()
2363 _count_elements(m, elems)
2364 self.assertEqual(m,
2365 OrderedDict([('a', 5), ('b', 2), ('r', 2), ('c', 1), ('d', 1)]))
2366
2367 # test fidelity to the pure python version
2368 c = CounterSubclassWithSetItem('abracadabra')
2369 self.assertTrue(c.called)
2370 self.assertEqual(dict(c), {'a': 5, 'b': 2, 'c': 1, 'd': 1, 'r':2 })
2371 c = CounterSubclassWithGet('abracadabra')
2372 self.assertTrue(c.called)
2373 self.assertEqual(dict(c), {'a': 5, 'b': 2, 'c': 1, 'd': 1, 'r':2 })
2374
2375 def test_multiset_operations_equivalent_to_set_operations(self):
2376 # When the multiplicities are all zero or one, multiset operations

Callers

nothing calls this directly

Calls 7

_count_elementsFunction · 0.90
OrderedDictClass · 0.90
listClass · 0.85
assertTrueMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected