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

Method test_get

Lib/test/test_mailbox.py:235–248  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

233 self.assertRaises(KeyError, lambda: self._box[key0])
234
235 def test_get(self):
236 # Retrieve messages using get()
237 key0 = self._box.add(self._template % 0)
238 msg = self._box.get(key0)
239 self.assertEqual(msg['from'], 'foo')
240 self.assertEqual(msg.get_payload(), '0\n')
241 self.assertIsNone(self._box.get('foo'))
242 self.assertIs(self._box.get('foo', False), False)
243 self._box.close()
244 self._box = self._factory(self._path)
245 key1 = self._box.add(self._template % 1)
246 msg = self._box.get(key1)
247 self.assertEqual(msg['from'], 'foo')
248 self.assertEqual(msg.get_payload(), '1\n')
249
250 def test_getitem(self):
251 # Retrieve message using __getitem__()

Callers

nothing calls this directly

Calls 8

get_payloadMethod · 0.80
assertIsNoneMethod · 0.80
_factoryMethod · 0.80
addMethod · 0.45
getMethod · 0.45
assertEqualMethod · 0.45
assertIsMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected