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

Method test_get

Lib/test/mapping_tests.py:130–142  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

128 # no test_fromkeys or test_copy as both os.environ and selves don't support it
129
130 def test_get(self):
131 d = self._empty_mapping()
132 self.assertIsNone(d.get(list(self.other.keys())[0]))
133 self.assertEqual(d.get(list(self.other.keys())[0], 3), 3)
134 d = self.reference
135 self.assertIsNone(d.get(list(self.other.keys())[0]))
136 self.assertEqual(d.get(list(self.other.keys())[0], 3), 3)
137 self.assertEqual(d.get(list(self.inmapping.keys())[0]),
138 list(self.inmapping.values())[0])
139 self.assertEqual(d.get(list(self.inmapping.keys())[0], 3),
140 list(self.inmapping.values())[0])
141 self.assertRaises(TypeError, d.get)
142 self.assertRaises(TypeError, d.get, None, None, None)
143
144
145class BasicTestMappingProtocol(BasicTestImmutableMappingProtocol):

Callers

nothing calls this directly

Calls 8

_empty_mappingMethod · 0.95
listClass · 0.85
assertIsNoneMethod · 0.80
getMethod · 0.45
keysMethod · 0.45
assertEqualMethod · 0.45
valuesMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected