예제 #1
0
 def test_sequence_file(self):
     """L{sequence_files} works correctly."""
     sequence_number = 200
     old_name = "audio.mp3"
     new_name = "%05d-%s" % (sequence_number, old_name)
     path_prefix = "%s%s" % (self.test_dir, os.sep)
     old_path = "%s%s" % (path_prefix, old_name)
     new_path = "%s%s" % (path_prefix, new_name)
     open(old_path, "w+").close()
     sequence_files(200, self.test_dir, [old_name])
     self.assertTrue(os.path.islink(old_path))
     self.assertFalse(os.path.islink(new_path))
     self.assertTrue(os.path.isfile(new_path))
예제 #2
0
 def test_sequence_file_with_empty_file_name_list(self):
     """
     L{sequence_files} ignores files that were not passed via the
     C{unsequenced_files} parameter.
     """
     sequence_number = 200
     old_name = "audio.mp3"
     new_name = "%05d-%s" % (sequence_number, old_name)
     path_prefix = "%s%s" % (self.test_dir, os.sep)
     old_path = "%s%s" % (path_prefix, old_name)
     new_path = "%s%s" % (path_prefix, new_name)
     open(old_path, "w+").close()
     sequence_files(200, self.test_dir, [])
     self.assertTrue(os.path.isfile(old_path))
     self.assertFalse(os.path.islink(old_path))
     self.assertFalse(os.access(new_path, os.F_OK))