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

Method test_lookup

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

Source from the content-addressed store, hash-verified

844 self.assertEqual(sorted(self._box._toc.keys()), sorted([key0, key1]))
845
846 def test_lookup(self):
847 # Look up message subpaths in the TOC
848 self.assertRaises(KeyError, lambda: self._box._lookup('foo'))
849 key0 = self._box.add(self._template % 0)
850 self.assertEqual(self._box._lookup(key0), os.path.join('new', key0))
851 os.remove(os.path.join(self._path, 'new', key0))
852 self.assertEqual(self._box._toc, {key0: os.path.join('new', key0)})
853 # Be sure that the TOC is read back from disk (see issue #6896
854 # about bad mtime behaviour on some systems).
855 self._box.flush()
856 self.assertRaises(KeyError, lambda: self._box._lookup(key0))
857 self.assertEqual(self._box._toc, {})
858
859 def test_lock_unlock(self):
860 # Lock and unlock the mailbox. For Maildir, this does nothing.

Callers

nothing calls this directly

Calls 7

assertRaisesMethod · 0.45
_lookupMethod · 0.45
addMethod · 0.45
assertEqualMethod · 0.45
joinMethod · 0.45
removeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected