Пример #1
0
def test_save_fails_and_dirs():
    onlyfiles = functions.print_files()
    onlydirs = functions.print_dirs()
    functions.save_fails_and_dirs()
    files_and_dirs = []
    with open("listdir.txt", 'r') as f:
        for line in f:
            for word in line.split():
                files_and_dirs.append(word)
    assert set(files_and_dirs).intersection(onlyfiles) == set(onlyfiles)
    assert set(files_and_dirs).intersection(onlydirs) == set(onlydirs)
Пример #2
0
while True:
    print(functions.display())
    choice = input('Выберите пункт меню')
    if choice == '1':
        name_of_dir = input("Введите имя папки: ")
        os.mkdir(name_of_dir)
    elif choice == '2':
        functions.remove_file_or_dir()
    elif choice == '3':
        functions.copy_file_or_dir()
    elif choice == '4':
        cwd = os.getcwd()
        print(os.listdir(path=cwd))
    elif choice == '5':
        print(functions.print_dirs())
    elif choice == '6':
        print(functions.print_files())
    elif choice == '7':
        print(platform.uname())
    elif choice == '8':
        print(functions.info_about_creator())
    elif choice == '9':
        victory()
    elif choice == '10':
        account_f()
    elif choice == '11':
        new_path = input("Введите путь к желаемой директории: ")
        functions.change_dir(new_path)
    elif choice == '12':
        functions.save_fails_and_dirs()
Пример #3
0
while True:
    functions.display()
    choice = input('Выберите пункт меню')
    if choice == '1':
        name_of_dir = input("Введите имя папки: ")
        os.mkdir(name_of_dir)
    elif choice == '2':
        functions.remove_file_or_dir()
    elif choice == '3':
        functions.copy_file_or_dir()
    elif choice == '4':
        cwd = os.getcwd()
        print(os.listdir(path=cwd))
    elif choice == '5':
        functions.print_dirs()
    elif choice == '6':
        functions.print_files()
    elif choice == '7':
        print(platform.uname())
    elif choice == '8':
        functions.info_about_creator()
    elif choice == '9':
        victory()
    elif choice == '10':
        account()
    elif choice == '11':
        functions.change_dir()
    elif choice == '12':
        exit()
        break
Пример #4
0
def test_change_dir():
    old_onlydirs = functions.print_dirs()
    functions.change_dir("C:/Users/Ольга")
    new_onlydirs = functions.print_dirs()
    assert old_onlydirs != new_onlydirs
Пример #5
0
def test_print_dirs():
    onlydirs = functions.print_dirs()
    onlyfiles = functions.print_files()
    assert list(set(onlydirs).intersection(onlyfiles)) == []