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

Method check_info

Lib/test/test_mailbox.py:878–899  ·  view source on GitHub ↗
(oldinfo, newinfo)

Source from the content-addressed store, hash-verified

876 msg = mailbox.MaildirMessage(self._template % 0)
877 key = self._box.add(msg)
878 def check_info(oldinfo, newinfo):
879 oldfilename = os.path.join(self._box._path, self._box._lookup(key))
880 newsubpath = self._box._lookup(key).split(self._box.colon)[0]
881 if newinfo:
882 newsubpath += self._box.colon + newinfo
883 newfilename = os.path.join(self._box._path, newsubpath)
884 # assert initial conditions
885 self.assertEqual(self._box.get_info(key), oldinfo)
886 if not oldinfo:
887 self.assertNotIn(self._box._lookup(key), self._box.colon)
888 self.assertTrue(os.path.exists(oldfilename))
889 if oldinfo != newinfo:
890 self.assertFalse(os.path.exists(newfilename))
891 # do the rename
892 self._box.set_info(key, newinfo)
893 # assert post conditions
894 if not newinfo:
895 self.assertNotIn(self._box._lookup(key), self._box.colon)
896 if oldinfo != newinfo:
897 self.assertFalse(os.path.exists(oldfilename))
898 self.assertTrue(os.path.exists(newfilename))
899 self.assertEqual(self._box.get_info(key), newinfo)
900 # none -> has info
901 check_info('', 'info1')
902 # has info -> same info

Callers

nothing calls this directly

Calls 10

assertNotInMethod · 0.80
assertTrueMethod · 0.80
assertFalseMethod · 0.80
joinMethod · 0.45
_lookupMethod · 0.45
splitMethod · 0.45
assertEqualMethod · 0.45
get_infoMethod · 0.45
existsMethod · 0.45
set_infoMethod · 0.45

Tested by

no test coverage detected