コード例 #1
0
 def test_get_parameters_with_parser(self):
     self.assertEqual(('.', r'.\destination_for_jpg', '.jpg'),
                      get_parameters_with_parser([]))
     self.assertEqual((r'.\source_files', r'.\destination_for_jpg', '.jpg'),
                      get_parameters_with_parser([
                          '-s', r'.\source_files', '-d',
                          r'.\destination_for_jpg', '-x', '.jpg'
                      ]))
     self.assertEqual((r'.\source_files', r'.\destination_for_txt', '.txt'),
                      get_parameters_with_parser([
                          '-s', r'.\source_files', '-d',
                          r'.\destination_for_txt', '-x', '.txt'
                      ]))
コード例 #2
0
 def test_selective_copy_jpg_files(self):
     source_path = os.path.join(self.test_dir, 'source_files')
     destination_path = os.path.join(self.test_dir, 'destination_for_jpg')
     source, destination, extension = get_parameters_with_parser(
         ['-s', source_path, '-d', destination_path, '-x', '.jpg'])
     copy_files_with_spec_extension(source, destination, extension)
     self.assertEqual([], os.listdir(destination_path))