(oldinfo, newinfo)
| 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 |
nothing calls this directly
no test coverage detected