Best Python code snippet using lisa_python
tools.py
Source: tools.py
...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']}"...
test_world.py
Source: test_world.py
...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')...
5_1.py
Source: 5_1.py
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:...
Check out the latest blogs from LambdaTest on this topic:
Automating testing is a crucial step in the development pipeline of a software product. In an agile development environment, where there is continuous development, deployment, and maintenance of software products, automation testing ensures that the end software products delivered are error-free.
Before we discuss the Joomla testing, let us understand the fundamentals of Joomla and how this content management system allows you to create and maintain web-based applications or websites without having to write and implement complex coding requirements.
The QA testing career includes following an often long, winding road filled with fun, chaos, challenges, and complexity. Financially, the spectrum is broad and influenced by location, company type, company size, and the QA tester’s experience level. QA testing is a profitable, enjoyable, and thriving career choice.
It’s strange to hear someone declare, “This can’t be tested.” In reply, I contend that everything can be tested. However, one must be pleased with the outcome of testing, which might include failure, financial loss, or personal injury. Could anything be tested when a claim is made with this understanding?
When it comes to UI components, there are two versatile methods that we can use to build it for your website: either we can use prebuilt components from a well-known library or framework, or we can develop our UI components from scratch.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!