MCPcopy Index your code
hub / github.com/python/cpython / test_literal_constructor

Method test_literal_constructor

Lib/test/test_dict.py:40–49  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

38 self.assertIsNot(dict(), {})
39
40 def test_literal_constructor(self):
41 # check literal constructor for different sized dicts
42 # (to exercise the BUILD_MAP oparg).
43 for n in (0, 1, 6, 256, 400):
44 items = [(''.join(random.sample(string.ascii_letters, 8)), i)
45 for i in range(n)]
46 random.shuffle(items)
47 formatted_items = ('{!r}: {:d}'.format(k, v) for k, v in items)
48 dictliteral = '{' + ', '.join(formatted_items) + '}'
49 self.assertEqual(eval(dictliteral), dict(items))
50
51 def test_merge_operator(self):
52

Callers

nothing calls this directly

Calls 5

shuffleMethod · 0.80
joinMethod · 0.45
sampleMethod · 0.45
formatMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected