(oldinfo, newinfo)
| 882 | msg = mailbox.MaildirMessage(self._template % 0) |
| 883 | key = self._box.add(msg) |
| 884 | def check_info(oldinfo, newinfo): |
| 885 | oldfilename = os.path.join(self._box._path, self._box._lookup(key)) |
| 886 | newsubpath = self._box._lookup(key).split(self._box.colon)[0] |
| 887 | if newinfo: |
| 888 | newsubpath += self._box.colon + newinfo |
| 889 | newfilename = os.path.join(self._box._path, newsubpath) |
| 890 | # assert initial conditions |
| 891 | self.assertEqual(self._box.get_info(key), oldinfo) |
| 892 | if not oldinfo: |
| 893 | self.assertNotIn(self._box._lookup(key), self._box.colon) |
| 894 | self.assertTrue(os.path.exists(oldfilename)) |
| 895 | if oldinfo != newinfo: |
| 896 | self.assertFalse(os.path.exists(newfilename)) |
| 897 | # do the rename |
| 898 | self._box.set_info(key, newinfo) |
| 899 | # assert post conditions |
| 900 | if not newinfo: |
| 901 | self.assertNotIn(self._box._lookup(key), self._box.colon) |
| 902 | if oldinfo != newinfo: |
| 903 | self.assertFalse(os.path.exists(oldfilename)) |
| 904 | self.assertTrue(os.path.exists(newfilename)) |
| 905 | self.assertEqual(self._box.get_info(key), newinfo) |
| 906 | # none -> has info |
| 907 | check_info('', 'info1') |
| 908 | # has info -> same info |
nothing calls this directly
no test coverage detected