Best Python code snippet using autotest_python
generate_readme.py
Source: generate_readme.py
...13 return '[' + name + ']' if name in name_to_links else name14def print_generated_projects():15 global nongames16 global games17 def print_projects(year_to_projects):18 for year, projects in year_to_projects.items():19 print('### ' + str(year))20 for p in projects:21 print('{:s} - {:s}\n'.format(22 md_bold(md_link_project(p['name'])),23 p['description']))24 tagline = []25 if 'languages' in p:26 tagline.append(27 'languages: **_{:s}_**'.format(', '.join(p['languages'])))28 if 'technologies' in p:29 tagline.append(30 'technologies: **_{:s}_**'.format(', '.join(p['technologies'])))31 for tag in tagline:32 print(' * ' + tag)33 print('\n')34 print_projects(nongames)35 print('## Games')36 print_projects(games)37def print_generated_link_references():38 global name_to_links39 print('[//]: #')40 for name, link in name_to_links.items():41 print('[{:s}]:<{:s}>'.format(name, link))42def main():43 PROJECTS_JSON_FILENAME = 'projects.json'44 MD_BEGIN = """# **Projects**45My projects and their Github links.46Organized into [projects](#projects) and [games](#games) sorted chronologically.47"""48 MD_END = """## Thanks for visiting!49If you have any questions, you can send me a message or reach me at nickwu@alumni.ubc.ca.50"""...
projektu_valdymas.py
Source: projektu_valdymas.py
1from projekto_modelis import Projektas, engine2from sqlalchemy.orm import sessionmaker3session = sessionmaker(bind=engine)()4def print_projects():5 print("--- PROJEKTAI ---")6 print("(#, Pavadinimas, Kaina, Sukurta)")7 projects = session.query(Projektas).all()8 for project in projects:9 print(project)10def new_project():11 print("--- Naujas Projektas ---")12 try:13 name = input("Pavadinimas: ")14 price = float(input("Kaina: "))15 except ValueError:16 print("KLAIDA: Kaina turi bÅ«ti skaiÄius.")17 return18 else:19 project = Projektas(name, price)20 session.add(project)21 session.commit()22 print(f"Projektas {project} sukurtas sÄkmingai")23def input_project():24 print_projects()25 try:26 project_id = int(input("Ä®veskite projekto ID: "))27 except ValueError:28 print("KLAIDA: ID turi bÅ«ti skaiÄius.")29 return None30 else:31 if project_id:32 project = session.query(Projektas).get(project_id)33 if project:34 return project35 else:36 print(f"KLAIDA: Projektas su ID: {project_id} neegzistuoja.")37 return None38def update_project():39 project = input_project()40 if project:41 try:42 name = input(f"Pavadinimas ({project.name}): ")43 price = float(input(f"Kaina ({project.price}): ") or 0)44 except ValueError:45 print("KLAIDA: kaina turi bÅ«ti skaiÄius.")46 return47 else:48 if len(name) > 0:49 project.name = name50 if price:51 project.price = price52 session.commit()53 print(f"Projektas {project} atnaujintas sÄkmingai.")54def delete_project():55 trinamas = input_project()56 if trinamas:57 session.delete(trinamas)58 session.commit()59 print(f"Projektas {trinamas} iÅ¡trintas sÄkmingai")60while True:61 print("=== Projektų valdymo duomenų bazÄ ===")62 print("- q: iÅ¡eiti")63 print("- r: rodyti visus projektus")64 print("- n: naujas projektas")65 print("- u: pakeisti projekto duomenis")66 print("- d: trinti projektÄ
")67 pasirinkimas = input("Pasirinkite: ").casefold()68 if pasirinkimas == "q":69 print("Viso gero!")70 break71 elif pasirinkimas == "r":72 print_projects()73 elif pasirinkimas == "n":74 new_project()75 elif pasirinkimas == "u":76 update_project()77 elif pasirinkimas == "d":78 delete_project()79 else:...
4_7_buildOrder.py
Source: 4_7_buildOrder.py
...44 project = self.projects[i[0]]45 dependency = self.projects[i[1]]46 project.dependencies.append(dependency)47 dependency.incoming_dependencies += 148 def print_projects(self, arr):49 for i in arr:50 print(i.node)51class Test(unittest.TestCase):52 def setUp(self):53 Project.projects = {}54 def test_add_projects(self):55 dep = [["a", "d"], ["f", "b"], ["f", "a"]]56 p = Project(dep)57 def test_buildOrder(self):58 dep = [["a", "d"], ["f", "a"]]59 p = Project(dep)60 # p.print_projects(p.buildOrder())61 self.assertEqual(["f", "a", "d"], p.buildOrder())62 def test_buildOrder_cycle(self):63 dep = [["a", "d"], ["d", "a"]]64 p = Project(dep)65 # p.print_projects(p.buildOrder())66 with self.assertRaises(Exception):...
Check out the latest blogs from LambdaTest on this topic:
How do we acquire knowledge? This is one of the seemingly basic but critical questions you and your team members must ask and consider. We are experts; therefore, we understand why we study and what we should learn. However, many of us do not give enough thought to how we learn.
Lack of training is something that creates a major roadblock for a tester. Often, testers working in an organization are all of a sudden forced to learn a new framework or an automation tool whenever a new project demands it. You may be overwhelmed on how to learn test automation, where to start from and how to master test automation for web applications, and mobile applications on a new technology so soon.
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 sky’s the limit (and even beyond that) when you want to run test automation. Technology has developed so much that you can reduce time and stay more productive than you used to 10 years ago. You needn’t put up with the limitations brought to you by Selenium if that’s your go-to automation testing tool. Instead, you can pick from various test automation frameworks and tools to write effective test cases and run them successfully.
Hola Testers! Hope you all had a great Thanksgiving weekend! To make this time more memorable, we at LambdaTest have something to offer you as a token of appreciation.
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!!