Best Python code snippet using lisa_python
test_find_provider.py
Source:test_find_provider.py
...46 airlines=airlines47 )48def get_repositories_from_directory():49 url = os.path.join(os.path.dirname(__file__), 'simple_sample')50 return get_repositories(url)51@pytest.mark.parametrize("get_repositories", [get_hardcoded_repositories, get_repositories_from_directory])52def test_enett_gwttp_win(get_repositories):53 result = find_provider(54 purchase_currency_code="EUR",55 purchase_amount_eur=100,56 channel_code="DY_AGENCY",57 airline_code="DY",58 get_repositories=get_repositories59 )60 assert len(result) == 261 item0 = result[0]62 item1 = result[1]63 for item in result:64 print(f"{item.rank} - {item.program_code}: {item.track_steps}")...
category_mutations.py
Source:category_mutations.py
...6from books.use_cases import *7from books.use_cases.exceptions import *8from books.use_cases.repositories import BaseCategoryRepository9@inject.autoparams()10def get_repositories(repository: BaseCategoryRepository):11 return repository12class CreateCategory(graphene.Mutation):13 class Arguments:14 name = graphene.String(required=True)15 Output = CategoryType16 @staticmethod17 def mutate(root, info, **args):18 try:19 return new_category(args, get_repositories())20 except CategoryAlreadyExists:21 raise GraphQLError("Category already exists") 22class UpdateCategory(graphene.Mutation):23 class Arguments:24 id = graphene.ID(required=True)25 name = graphene.String(required=True)26 Output = CategoryType27 @staticmethod28 def mutate(root, info, **args):29 try:30 return update_category(args, get_repositories())31 except CategoryDoesNotExists:32 raise GraphQLError("Category does not exists")33 except CategoryAlreadyExists:...
formula.py
Source:formula.py
1#!/usr/bin/python32import requests3def run():4 url = "https://api.github.com/users/andrew/repos"5 result = get_repositories(url)6 print(result)7 print(len(result))8def get_repositories(url):9 result = []10 r = requests.get(url=url)11 if 'next' in r.links :12 result += get_repositories(r.links['next']['url'])13 for repository in r.json():14 result.append(repository.get('name'))...
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!!