try: answer = input(f'Текущая директория: {current_dir}\n' f'chdir - Сменить директорию\n' f'select - Выбрать {number_} файл\n') if answer == 'chdir': show_dirs(files) path_text = 'Выберите папку' elif answer == 'select': show_files(files) path_text = 'Выберите файл' path_ = int(input(path_text)) if answer == 'chdir': if not main_dialog(answer, files[path_]): print('Ошибка перехода в директорию') continue elif answer == 'select': try: if not first_keys: first_keys = main_dialog(answer, files[path_]) if first_keys: print('Первый файл обработан') number_ = 'второй' else: print('Не смог получить ключи из первого файла') else: second_keys = main_dialog(answer, files[path_]) if first_keys:
def test_cannot_get_keys_select_command_main_dialog(select_command, unexpected_select_path): result_ = main_dialog(select_command, unexpected_select_path) assert not result_
def test_get_keys_select_command_main_dialog(select_command, small_file): result_ = main_dialog(select_command, small_file) assert result_
def test_failed_chdir_command_main_dialog(chdir_command, unexpected_chdir_path): result_ = main_dialog(chdir_command, unexpected_chdir_path) assert not result_
def test_chdir_command_main_dialog(chdir_command, expected_chdir_path): result_ = main_dialog(chdir_command, expected_chdir_path) assert result_
def test_unknown_command_main_dialog(unknown_command): result_ = main_dialog(unknown_command) assert not result_