Best Python code snippet using lettuce_webdriver_python
test_lazy_function.py
Source: test_lazy_function.py
...9 assert isinstance(f(1, 2), thunk)10def test_not_decorator():11 def g(a, b):12 return a - b13 g = lazy_function(g)14 assert isinstance(g(1, 2), thunk)15def test_lazy_call():16 called = False17 @lazy_function18 def g():19 nonlocal called20 called = True21 result = g()22 assert not called23 strict(result)24 assert called25def test_is():26 @lazy_function27 def g():28 return 1 is 129 a = g()30 assert isinstance(a, thunk)31 assert strict(a)32 @lazy_function33 def h(a):34 return a is None35 b = h(None)36 assert isinstance(b, thunk)37 assert strict(b)38 c = h('not none')39 assert isinstance(c, thunk)40 assert not strict(c)41def test_not():42 @lazy_function43 def g():44 return not 145 a = g()46 assert isinstance(a, thunk)47 assert not strict(a)48 @lazy_function49 def h(a):50 return not a51 b = h(False)52 assert isinstance(b, thunk)53 assert strict(b)54 c = h(True)55 assert isinstance(c, thunk)56 assert not strict(c)57@pytest.mark.parametrize('f,val', (58 (lambda: 1, 1),59 (lambda: 'a', 'a'),60 (lambda: (1, 2), (1, 2)),61 (lambda: b'a', b'a'),62))63def test_const(f, val):64 f = strict(lazy_function(f))65 assert isinstance(f(), thunk)66 assert f() == val67def test_dict_literal():68 @strict69 @lazy_function70 def f():71 return {'a': 1, 'b': 2}72 assert isinstance(f(), thunk)73 assert f() == {'a': 1, 'b': 2}74 assert isinstance(f()['a'], thunk)75def test_dict_comprehension():76 @strict77 @lazy_function78 def f():...
averageplot.py
Source: averageplot.py
1import csv2from collections import Counter 3from heapq import nlargest4import numpy as np5import matplotlib.pyplot as plt67########## Should scrub empty keys in dictionary, even nested dictionaries... Which this turns into after sorting8def tlc_scrub(noluv):9 if type(noluv) is dict:10 return dict((lefteye, tlc_scrub(kandi)) for lefteye, kandi in noluv.items() if kandi and tlc_scrub(kandi))11 else:12 return noluv1314keys = []15values = []16############################################################ Main Function to extrapolate the frequency of the items inside columns17def average_fighter(index):1819 record_words = []20 with open('stats.csv', 'r') as csvfile:21 reader = csv.reader(csvfile)22 next_reader = next(reader)23 col_name = next_reader[index]24 print('\n--------------------------\nSorted Freq for Top ' + col_name + ':\n--------------------------')25 for row in reader:26 csv_words = row[index].split(" ")27 for i in csv_words:28 record_words.append(i)2930 avglist_record = []31 for i in record_words:32 x = record_words.count(i)33 avglist_record.append((i,x))3435 36 averages_unique_record = dict(set(avglist_record)) # cast it as a dictionary to use .get() method37 def cleaningcrew(diction):38 return {39 k: v40 for k, v in averages_unique_record.items()41 if v is not None42 }43 aur_empty = cleaningcrew(averages_unique_record)44 items = aur_empty.items()45 for item in items:46 keys.append(item[0])47 values.append(item[1])4849 # aur = sorted(averages_unique_record, key=averages_unique_record.get, reverse=True)50 51 aur_scrubed = tlc_scrub(averages_unique_record)52 aur = nlargest(5, aur_scrubed, key = aur_scrubed.get) 5354 for val in aur:55 print(val, ":", averages_unique_record.get(val)) 5657############################################################ 5859def statcomp(x):60 average_fighter(x)6162############################################################ Because I'm Lazy 63# lazy_function = 36465# while lazy_function <= 15:66# average_fighter(lazy_function)67# lazy_function += 168# if lazy_function == 16:69# print('\n--------------------------\nAll Top Stats Defined.')7071############################################################ 72# ['cap-date', 'name', 'record', 'height', 'weight', 'reach', 'stance', 'dob', 73# 0 1 2 3 4 5 6 7 74#'slpm', 'stracc', 'sapm', 'strdef', 'tdavg', 'tdacc', 'tddef', 'subavg', '']75# 8 9 10 11 12 13 14 1576############################################################ 77
...
averagesHalo.py
Source: averagesHalo.py
123import csv4from collections import Counter 5from heapq import nlargest6from halo import Halo78spinner = Halo(text='Loading', text_color='white', spinner='pong')9spinner.start()1011########## Should scrub empty keys in dictionary, even nested dictionaries... Which this turns into after sorting12def tlc_scrub(noluv):13 if type(noluv) is dict:14 return dict((lefteye, tlc_scrub(kandi)) for lefteye, kandi in noluv.items() if kandi and tlc_scrub(kandi))15 else:16 return noluv1718############################################################ Main Function to extrapolate the frequency of the items inside columns19def average_fighter(index):20 record_words = []21 with open('purestats2.csv', 'r') as csvfile:22 reader = csv.reader(csvfile)23 next_reader = next(reader)24 col_name = next_reader[index]25 print('\n--------------------------\nSorted Freq for Top ' + col_name + ':\n--------------------------')26 for row in reader:27 csv_words = row[index].split(" ")28 for i in csv_words:29 record_words.append(i)3031 avglist_record = []32 for i in record_words:33 x = record_words.count(i)34 avglist_record.append((i,x))3536 averages_unique_record = dict(set(avglist_record)) # cast it as a dictionary to use .get() method37 # aur = sorted(averages_unique_record, key=averages_unique_record.get, reverse=True)38 aur_scrubed = tlc_scrub(averages_unique_record)39 aur = nlargest(5, aur_scrubed, key = aur_scrubed.get) 4041 for val in aur:42 spinner.clear()43 print(val, ":", averages_unique_record.get(val)) 4445############################################################ Because I'm Lazy 46lazy_function = 34748while lazy_function <= 15:49 average_fighter(lazy_function)50 lazy_function += 151 if lazy_function == 16:52 print('\n--------------------------\nAll Top Stats Defined.')53
...
Check out the latest blogs from LambdaTest on this topic:
API (Application Programming Interface) is a set of definitions and protocols for building and integrating applications. It’s occasionally referred to as a contract between an information provider and an information user establishing the content required from the consumer and the content needed by the producer.
There is just one area where each member of the software testing community has a distinct point of view! Metrics! This contentious issue sparks intense disputes, and most conversations finish with no definitive conclusion. It covers a wide range of topics: How can testing efforts be measured? What is the most effective technique to assess effectiveness? Which of the many components should be quantified? How can we measure the quality of our testing performance, among other things?
When I started writing tests with Cypress, I was always going to use the user interface to interact and change the application’s state when running tests.
Many theoretical descriptions explain the role of the Scrum Master as a vital member of the Scrum team. However, these descriptions do not provide an honest answer to the fundamental question: “What are the day-to-day activities of a Scrum Master?”
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!!