2629881

Untitled

Aug 2nd, 2021
624
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # metoda w src.bin.model
  2. def find_newest_image_in_output_folder(path):
  3.     list_dir_list = []
  4.     for file in os.listdir(path):
  5.         list_dir_list.append(file)
  6.     print(f"Opened miniature of: {list_dir_list[-1]}")
  7.     return list_dir_list[-1]
  8.  
  9. # metoda w tests.test_model
  10. @mock.patch('src.bin.model.os.listdir')
  11. def test_find_newest_image_in_output_folder(self, mock_listdir_path):
  12.     mock_listdir_path.return_value = ['123.jpg', '124.jpg', '125.jpg']
  13.     list_dir_list = find_newest_image_in_output_folder('.')
  14.     self.assertEqual('125.jpg', list_dir_list)
RAW Paste Data