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

Method test_keys

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

Source from the content-addressed store, hash-verified

87 self.assertIs(bool({1: 2}), True)
88
89 def test_keys(self):
90 d = {}
91 self.assertEqual(set(d.keys()), set())
92 d = {'a': 1, 'b': 2}
93 k = d.keys()
94 self.assertEqual(set(k), {'a', 'b'})
95 self.assertIn('a', k)
96 self.assertIn('b', k)
97 self.assertIn('a', d)
98 self.assertIn('b', d)
99 self.assertRaises(TypeError, d.keys, None)
100 self.assertEqual(repr(dict(a=1).keys()), "dict_keys(['a'])")
101
102 def test_values(self):
103 d = {}

Callers

nothing calls this directly

Calls 5

setFunction · 0.85
assertInMethod · 0.80
assertEqualMethod · 0.45
keysMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected