How to use check_exit method in lisa

Best Python code snippet using lisa_python

tools.py

Source:tools.py Github

copy

Full Screen

...11 "Для получения данной информации Вам необходимо зарегистрироваться на сайте \n" \12 "https://dadata.ru/profile/#info\n" \13 "и полученный после регистрации токен указать при регистрации на данной платформе.\n" \14 "Для выхода из программы Вам необходимо написать 'выход', "15def check_exit(string):16 if string.lower() == "выход":17 return True18 return False19def create_db(cursor):20 cursor.execute("""CREATE TABLE IF NOT EXISTS users (21 name TEXT NOT NULL,22 key TEXT NOT NULL,23 language TEXT NOT NULL24 );""")25def registration_user(connection, cursor):26 name_user = input("Введите ваше имя: ")27 if check_exit(name_user):28 print(END_MESSAGE)29 sys.exit(-1)30 token_user = input("Введите Ваш токен: ")31 if check_exit(token_user):32 print(END_MESSAGE)33 sys.exit(-1)34 print("На каком языке показывать список адресов")35 language_user = input("1 - русский 2 - английский\n")36 check_exit(language_user)37 if language_user == "1":38 language_user = "ru"39 else:40 language_user = "en"41 cursor.execute(f"INSERT INTO users VALUES ('{name_user}', '{token_user}', '{language_user}');")42 connection.commit()43 user = (name_user, token_user, language_user)44 return user45def get_list_users(cursor):46 cursor.execute(f"SELECT * FROM users;")47 i = 148 answer = cursor.fetchall()49 for row in answer:50 print(f"{i} - {row[0]}")51 i += 152 user = input("Введите номер вашего аккаунта: ")53 if check_exit(user):54 print(END_MESSAGE)55 sys.exit(-1)56 return answer[int(user) - 1]57def start_program(connection, cursor):58 print(WELCOME_HEADER)59 first_start = input()60 if check_exit(first_start):61 print(END_MESSAGE)62 sys.exit(-1)63 if first_start == "2":64 create_db(cursor)65 print(REGISTRATION_HEADER)66 user = registration_user(connection, cursor)67 else:68 print(AUTHORIZATION_HEADER)69 user = get_list_users(cursor)70 return user71def search_geo(session, user):72 while True:73 test_request = input("Введите адрес: ")74 if check_exit(test_request):75 break76 result = session.suggest("address", test_request, language=user[2])77 list_of_address = list()78 i = 079 for element in result:80 address = element["value"]81 list_of_address.append(address)82 print(f"{i + 1} - {address}")83 i += 184 number_address = input("Укажите точный адрес (введите номер): ")85 if check_exit(number_address):86 break87 accurate_address = result[int(number_address) - 1]88 print(f"Координаты выбранного места:\nШирота {accurate_address['data']['geo_lat']}"...

Full Screen

Full Screen

test_world.py

Source:test_world.py Github

copy

Full Screen

...26 self.assertEqual(self.world.get_room((5, 5)).name, 'room_name3')27 def test_check_get_exit(self):28 print('TestWorld: check get exit')29 position = (5, 5)30 self.assertFalse(self.world.check_exit(position, DIRECTIONS['north']))31 self.assertFalse(self.world.check_exit(position, DIRECTIONS['south']))32 self.assertFalse(self.world.check_exit(position, DIRECTIONS['east']))33 self.assertFalse(self.world.check_exit(position, DIRECTIONS['west']))34 self.assertEqual(self.world.get_room_exits(position), 'Exits: ')35 self.world.add_room(Room('room_north', 'room_description'), (5, 4))36 self.assertTrue(self.world.check_exit(position, DIRECTIONS['north']))37 self.assertFalse(self.world.check_exit(position, DIRECTIONS['south']))38 self.assertFalse(self.world.check_exit(position, DIRECTIONS['east']))39 self.assertFalse(self.world.check_exit(position, DIRECTIONS['west']))40 self.assertEqual(self.world.get_room_exits(position), 'Exits: north')41 self.world.add_room(Room('room_south', 'room_description'), (5, 6))42 self.assertTrue(self.world.check_exit(position, DIRECTIONS['south']))43 self.assertEqual(self.world.get_room_exits(position), 'Exits: north, south')44 self.world.add_room(Room('room_east', 'room_description'), (6, 5))45 self.assertTrue(self.world.check_exit(position, DIRECTIONS['east']))46 self.assertEqual(self.world.get_room_exits(position), 'Exits: north, south, east')47 self.world.add_room(Room('room_west', 'room_description'), (4, 5))48 self.assertTrue(self.world.check_exit(position, DIRECTIONS['west']))49 self.assertEqual(self.world.get_room_exits(position), 'Exits: north, south, east, west')50"""51 def test_attribute_update(self):52 print('TestRoom: attribute update')53 self.room.name = 'new_name'54 self.assertEqual(str(self.room), 'new_name\ntest_description')55 self.room.description = 'new_description'56 self.assertEqual(str(self.room), 'new_name\nnew_description')57 self.room.name = ['unexpected', 'list']58 self.assertEqual(str(self.room), 'default_name\nnew_description')59 self.room.description = ['unexpected', 'list']60 self.assertEqual(str(self.room), 'default_name\ndefault_description')...

Full Screen

Full Screen

5_1.py

Source:5_1.py Github

copy

Full Screen

1documents = [2 {"type": "passport", "number": "2207 876234", "name": "Василий Гупкин"},3 {"type": "invoice", "number": "11-2", "name": "Геннадий Покемонов"},4 {"type": "insurance", "number": "10006", "name": "Аристарх Павлов"}5]6directories = {7 '1': ['2207 876234', '11-2'],8 '2': ['10006'],9 '3': []10}11def check_people(doc, pasp):12 find = False13 for docs in doc:14 if docs['number']==pasp:15 out = docs['name']16 find = True17 if not find:18 out = ("document nof found")19 return out20def find_shelf(shelf, pasp):21 find = False22 for shelfs_key, shelfs_value in shelf.items():23 if pasp in shelfs_value:24 out = shelfs_key25 find = True26 if not find:27 out = ("document nof found")28 return out29def show_documents(doc):30 for docs in doc:31 print(f"{docs['type']} {docs['number']} {docs['name']}")32def add_shelf(directories, name):33 if name in directories.keys():34 print('key found')35 else:36 print('Key added')37 directories[name]=[]38def show_shelf():39 print(directories)40def add_document():41def core(commanda):42 if commanda=="p":43 pasp = input("Please, insert document number: ")44 print(check_people(documents, pasp))45 status_exit = False46 while not status_exit:47 check_exit = input('Would you like continue check? Please tip "Yes or No"')48 if check_exit == "No":49 status_exit = True50 elif check_exit == "Yes":51 pasp = input("Please, insert document number: ")52 print(check_people(documents, pasp))53 else:54 print("Incorrect command")55 elif commanda=="s":56 print("shelf")57 pasp = input("Please, insert document number: ")58 print(find_shelf(directories, pasp))59 status_exit = False60 while not status_exit:61 check_exit = input('Would you like continue check? Please tip "Yes or No"')62 if check_exit == "No":63 status_exit = True64 elif check_exit == "Yes":65 pasp = input("Please, insert document number: ")66 print(find_shelf(directories, pasp))67 else:68 print("Incorrect command")69 elif commanda == "l":70 print("list")71 show_documents(documents)72 elif commanda=="as":73 print("add")74 name_shelf = input("Please, inter shelf name: ")75 print(add_shelf(directories, name_shelf))76 status_exit = False77 while not status_exit:78 check_exit = input('Would you like continue check? Please tip "Yes or No"')79 if check_exit == "No":80 status_exit = True81 elif check_exit == "Yes":82 name_shelf = input("Please, inter shelf name: ")83 print(add_shelf(directories, name_shelf))84 else:85 print("Incorrect command")86 elif commanda=="i":87 print("insert")88 elif commanda=="d":89 print("delete")90 elif commanda == "ss":91 show_shelf()92command = input("Please insert command: ")93while command != 'e':94 core(command)95 command = input("Please insert command: ")96else:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run lisa automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful