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)
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() elif choice == '13': functions.exit()
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 else: print('Неверный пункт меню')
def test_print_files(): assert functions.print_files() == [ f for f in os.listdir(os.getcwd()) if os.path.isfile(os.path.join(os.getcwd(), f)) ]
def test_print_dirs(): onlydirs = functions.print_dirs() onlyfiles = functions.print_files() assert list(set(onlydirs).intersection(onlyfiles)) == []