MCPcopy Create free account
hub / github.com/python/cpython / test_lookup

Method test_lookup

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

Source from the content-addressed store, hash-verified

850 self.assertEqual(sorted(self._box._toc.keys()), sorted([key0, key1]))
851
852 def test_lookup(self):
853 # Look up message subpaths in the TOC
854 self.assertRaises(KeyError, lambda: self._box._lookup('foo'))
855 key0 = self._box.add(self._template % 0)
856 self.assertEqual(self._box._lookup(key0), os.path.join('new', key0))
857 os.remove(os.path.join(self._path, 'new', key0))
858 self.assertEqual(self._box._toc, {key0: os.path.join('new', key0)})
859 # Be sure that the TOC is read back from disk (see issue #6896
860 # about bad mtime behaviour on some systems).
861 self._box.flush()
862 self.assertRaises(KeyError, lambda: self._box._lookup(key0))
863 self.assertEqual(self._box._toc, {})
864
865 def test_lock_unlock(self):
866 # 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