コード例 #1
0
    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:
コード例 #2
0
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_
コード例 #3
0
def test_get_keys_select_command_main_dialog(select_command, small_file):
    result_ = main_dialog(select_command, small_file)
    assert result_
コード例 #4
0
def test_failed_chdir_command_main_dialog(chdir_command,
                                          unexpected_chdir_path):
    result_ = main_dialog(chdir_command, unexpected_chdir_path)
    assert not result_
コード例 #5
0
def test_chdir_command_main_dialog(chdir_command, expected_chdir_path):
    result_ = main_dialog(chdir_command, expected_chdir_path)
    assert result_
コード例 #6
0
def test_unknown_command_main_dialog(unknown_command):
    result_ = main_dialog(unknown_command)
    assert not result_