Best Python code snippet using Airtest
run1.py
Source: run1.py
...7basedir='/Users/dcollins/RESEARCH3/Paper19_47_overlap/0000_main_plots/'8glob1 = "%s/density_radius/density_radius_c????.png"%basedir9reg1 = re.compile(r"%s/density_radius/density_radius_c(\d\d\d\d).png"%basedir)10p1 = product.product('rho_r',regexp=reg1,myglob=glob1,parameters=['core_id'],style='single',width=400)11p1.get_frames()12glob1 = "%s/core_proj_follow/density_radius_c????.png"%basedir13glob2 = r"%s/core_proj_follow/follow_c????_n????_centered_Projection_x_density.png"%(basedir)14reg2 = re.compile(r"%s/core_proj_follow/follow_c(\d\d\d\d)_n(\d\d\d\d)_centered_Projection_x_density.png"%(basedir))15p2 = product.product('core_proj_follow',regexp=reg2,myglob=glob2,parameters=['core_id','frame'],style='frames',width=400)16#p2.check_glob()17p2.get_frames()18basedir='/Users/dcollins/RESEARCH3/Paper19_47_overlap/0000_main_plots/'19globn = "%s/density_time_all_cores/with_proper_tff/all/test_density_5_c????.png"%basedir20regn = re.compile(r"%s/density_time_all_cores/with_proper_tff/all/test_density_5_c(\d\d\d\d).png"%basedir)21p3 = product.product('rho_t',regexp=regn,myglob=globn,parameters=['core_id'],style='single',width=400)22p3.get_frames()23globn = "%s/density_radius_subfits/density_radius_c????.png"%basedir24regn = re.compile("%s/density_radius_subfits/density_radius_c(\d\d\d\d).png"%basedir)25p4 = product.product('alpha_t',regexp=regn,myglob=globn,parameters=['core_id'],style='single',width=400)26p4.get_frames()27globn = "%s/velocity/velocity_radius_components_rel/vi_r_c????.png"%basedir28regn = re.compile("%s/velocity/velocity_radius_components_rel/vi_r_c(\d\d\d\d).png"%basedir)29p5 = product.product('v_r_rel',regexp=regn,myglob=globn,parameters=['core_id'],style='single',width=400)30p5.get_frames()31globn = "%s/velocity/velocity_time_components_rel/vi_t_rel_c????.png"%basedir32regn = re.compile("%s/velocity/velocity_time_components_rel/vi_t_rel_c(\d\d\d\d).png"%basedir)33p6 = product.product('v_t_rel',regexp=regn,myglob=globn,parameters=['core_id'],style='single',width=400)34p6.get_frames()35globn = "%s//velocity/velocity_time_components_avg/vi_t_rel_c????.png"%basedir36regn = re.compile("%s//velocity/velocity_time_components_avg/vi_t_rel_c(\d\d\d\d).png"%basedir)37p7 = product.product('v_t_rel_sigma',regexp=regn,myglob=globn,parameters=['core_id'],style='single',width=400)38p7.get_frames()39globn = "%s//velocity/velocity_radius_symlog/vi_r_symlog_c????.png"%basedir40regn = re.compile(r"%s//velocity/velocity_radius_symlog/vi_r_symlog_c(\d\d\d\d).png"%basedir)41p8 = product.product('v_r_sym',regexp=regn,myglob=globn,parameters=['core_id'],style='single',width=400)42p8.get_frames()43globn = "%s/zoom1/x/c????/test_full_particles_c????_n????_Projection_x_density.png"%basedir44regn = re.compile(r"%s/zoom1/x/c(\d\d\d\d)/test_full_particles_c(\d\d\d\d)_n(\d\d\d\d)_Projection_x_density.png"%basedir)45p9 = product.product('v_r_sym',regexp=regn,myglob=globn,parameters=['core_id','core_id','frame'],style='frames',width=400)46p9.get_frames()47globn = "%s/zoom2/x/c????/u05_centroids_zoom2_c????_n????_Projection_x_density.png"%basedir48regn = re.compile(r"%s/zoom2/x/c(\d\d\d\d)/u05_centroids_zoom2_c(\d\d\d\d)_n(\d\d\d\d)_Projection_x_density.png"%basedir)49p10 = product.product('v_r_sym',regexp=regn,myglob=globn,parameters=['core_id','core_id','frame'],style='frames',width=400)50p10.get_frames()51#zoom 2, just the last frame 52globn = "%s/zoom2/x/c????/u05_centroids_zoom2_c????_n0125_Projection_x_density.png"%basedir53regn = re.compile(r"%s/zoom2/x/c(\d\d\d\d)/u05_centroids_zoom2_c(\d\d\d\d)_n0125_Projection_x_density.png"%basedir)54p10 = product.product('v_r_sym',regexp=regn,myglob=globn,parameters=['core_id','core_id'],style='single',width=400)55p10.get_frames()56#zoom 4, just the last frame 57globn = "%s/zoom4/x/c????/u05_centroids_zoom4_c????_n0125_Projection_x_density.png"%basedir58regn = re.compile(r"%s/zoom4/x/c(\d\d\d\d)/u05_centroids_zoom4_c(\d\d\d\d)_n0125_Projection_x_density.png"%basedir)59p11 = product.product('v_r_sym',regexp=regn,myglob=globn,parameters=['core_id','core_id'],style='single',width=400)60p11.get_frames()61#zoom 4, just the last frame 62p12 = product.product('rando',style='numbertest',width=400)63p12.get_frames()64p13 = product.product('Tc_raw',fname='browser/u05_ct.h5',field='collapse_times',style='value',width=400)65p14 = product.product('Tc_global',fname='browser/u05_ct_glob.h5',field='collapse_times',style='value',width=400)66p15 = product.product('Tc_local',fname='browser/u05_ct_local.h5',field='collapse_times',style='value',width=400)67large1 = [26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 38, 39, 40, 47, 49, 50, 51, 53, 56, 63, 220]68suburbs1 = [41, 42, 43, 44, 45, 46, 54, 55, 57, 58, 64, 108, 110, 111, 113]69core_list = large1 + suburbs1 70core_list=None71cl=make_page.make_page([p14,p15,p13,p12,p3,p4,p7,p8,p5,p2,p9,p11],...
get_frames.py
Source: get_frames.py
...41 elif type == 'GIF':42 dest = f'{frame_destination}/GIFs/{sq}.gif'43 cmd = f'ffmpeg -y -ss {t_init_sq_st} -to {t_end_sq_st} -i "{movie_location}" -f gif /tmp/tmp.gif'44 return cmd, dest45def get_frames(type, init_extraction, rewinds, capture):46 cmd, dest = get_command(type, init_extraction, rewinds, capture)47 os.system(cmd)48 return cmd, dest49def generate_nft(init_extraction, rewinds=3.5, capture=2, text_index=-1):50 texts = ["En los blockchains\ncapaces de contener NFTs \ntodas las operaciones \nson públicas.",51 "Not your keys,\n not your coins!",52 "Nunca muestres tu 'seed'\n\nQuien la tenga,\n ¡tiene tu dinero!\n ¡y tu identidad!",53 "Tu 'wallet'\n\n no tiene el dinero,\n tiene las claves para...\n\n\n ¡firmar!",54 "El NFT es\n\nun registro de propiedad\n\nde un OBJETO (digital)\nen un BLOCKCHAIN,\n\nno de los derechos\nde autor o reproducción.",55 "Non-fungible:\nuna entrada de cine.\n\nFungible: un billete.\n\n\nAmbos tienen un valor\npero la entrada \ntiene propiedades\nque la hacen única.",56 ]57 cmd, dest = get_frames('GIF', init_extraction, rewinds, capture)58 end = len(texts) - 159 if text_index == -1:60 text_index = random.randint(0, end)61 text = texts[text_index]62 add_text_layer_gif('/tmp/tmp.gif', dest, text)63# get_frames('00:01:00')64generate_nft('00:01:13', text_index=1)65#exit(0)66generate_nft('00:01:18', rewinds=5, capture=2)67generate_nft('00:01:48', rewinds=4, capture=2)68# get_frames('00:01:59')69# get_frames('00:02:23')70generate_nft('00:02:41', rewinds=3, capture=2)71generate_nft('00:03:05')72generate_nft('00:05:12', rewinds=4, capture=2)73# get_frames('00:09:29', rewinds=3, capture=1)74generate_nft('00:12:38', rewinds=3, capture=1, text_index=1)75# get_frames('00:18:36', rewinds=3, capture=3)76generate_nft('00:19:04', rewinds=3, capture=5)77# get_frames('00:19:09')78# get_frames('00:19:29', rewinds=3.5, capture=5)79# get_frames('00:20:04', rewinds=3.5, capture=5)80# get_frames('00:20:19')81generate_nft('00:20:51')82# get_frames('00:21:06')83# get_frames('00:21:34')84generate_nft('00:21:38', rewinds=2, capture=3, text_index=1)85generate_nft('00:22:34', rewinds=3.5, capture=4)86# get_frames('00:23:17', rewinds=3.5, capture=4)87# get_frames('00:25:13')88# get_frames('00:27:30', rewinds=3.5, capture=3)89generate_nft('00:27:51', rewinds=2, capture=4)90generate_nft('00:28:07')91generate_nft('00:28:13', rewinds=2, capture=5, text_index=2)92# get_frames('00:29:28')93generate_nft('00:29:58', rewinds=2, capture=2)94# get_frames('00:36:13')95# get_frames('00:37:09')96generate_nft('00:38:38')97generate_nft('00:40:07', rewinds=1, capture=10)98generate_nft('00:48:46', rewinds=5, capture=3)99generate_nft('00:55:50', rewinds=3.5, capture=1, text_index=1)100generate_nft('01:00:33', rewinds=0, capture=2, text_index=0)101generate_nft('01:06:10', rewinds=1, capture=5)102# get_frames('01:11:23')103generate_nft('01:16:49')104generate_nft('01:22:24', rewinds=2, capture=3)105generate_nft('01:22:30', rewinds=2, capture=3)106generate_nft('01:22:40', rewinds=4, capture=10)...
test_models.py
Source: test_models.py
...35 # wrong player36 g.post_frame(p2, [Frame.Shot.zero, Frame.Shot.one])37 # Frame #138 g.post_frame(p1, [Frame.Shot.zero, Frame.Shot.one])39 assert len(g.get_frames(p1.id)) == 140 assert len(g.get_frames(p2.id)) == 041 assert len(g.get_frames(p3.id)) == 042 assert g.totals[p1.id] == 143 assert g.totals[p2.id] == 044 assert g.totals[p3.id] == 045 assert g.get_frames(p1.id)[0].score == 146 assert g.get_frames(p1.id)[0].complete == True47 g.post_frame(p2, [Frame.Shot.three, Frame.Shot.spare])48 assert len(g.get_frames(p1.id)) == 149 assert len(g.get_frames(p2.id)) == 150 assert len(g.get_frames(p3.id)) == 051 assert g.totals[p1.id] == 152 assert g.totals[p2.id] == 053 assert g.totals[p3.id] == 054 assert g.get_frames(p2.id)[0].score == 055 assert g.get_frames(p2.id)[0].complete == False56 g.post_frame(p3, [Frame.Shot.strike, Frame.Shot.nil])57 assert len(g.get_frames(p1.id)) == 158 assert len(g.get_frames(p2.id)) == 159 assert len(g.get_frames(p3.id)) == 160 assert g.totals[p1.id] == 161 assert g.totals[p2.id] == 062 assert g.totals[p3.id] == 063 assert g.get_frames(p3.id)[0].score == 064 assert g.get_frames(p3.id)[0].complete == False65 assert g.current_frame == 266 # Frame #2 - Fight!67 g.post_frame(p1, [Frame.Shot.three, Frame.Shot.six])68 assert len(g.get_frames(p1.id)) == 269 assert len(g.get_frames(p2.id)) == 170 assert len(g.get_frames(p3.id)) == 171 assert g.totals[p1.id] == 1072 assert g.totals[p2.id] == 073 assert g.totals[p3.id] == 074 assert g.get_frames(p1.id)[1].score == 975 assert g.get_frames(p1.id)[1].complete == True76 g.post_frame(p2, [Frame.Shot.three, Frame.Shot.four])77 assert len(g.get_frames(p1.id)) == 278 assert len(g.get_frames(p2.id)) == 279 assert len(g.get_frames(p3.id)) == 180 assert g.totals[p1.id] == 1081 assert g.totals[p2.id] == 2082 assert g.totals[p3.id] == 083 assert g.get_frames(p2.id)[0].score == 1384 assert g.get_frames(p2.id)[1].score == 785 assert g.get_frames(p2.id)[0].complete == True86 assert g.get_frames(p2.id)[1].complete == True87 g.post_frame(p3, [Frame.Shot.four, Frame.Shot.spare])88 assert len(g.get_frames(p1.id)) == 289 assert len(g.get_frames(p2.id)) == 290 assert len(g.get_frames(p3.id)) == 291 assert g.totals[p1.id] == 1092 assert g.totals[p2.id] == 2093 assert g.totals[p3.id] == 2094 assert g.get_frames(p3.id)[0].score == 2095 assert g.get_frames(p3.id)[1].score == 096 assert g.get_frames(p3.id)[0].complete == True97 assert g.get_frames(p3.id)[1].complete == False98 assert g.current_frame == 399class TestFrame(object):100 def test_create_frame(self):101 p1 = Player('Mario Mario')102 f1 = Frame(p1)103 assert f1.score == 0104 assert f1.player == p1...
Check out the latest blogs from LambdaTest on this topic:
Unit testing is typically software testing within the developer domain. As the QA role expands in DevOps, QAOps, DesignOps, or within an Agile team, QA testers often find themselves creating unit tests. QA testers may create unit tests within the code using a specified unit testing tool, or independently using a variety of methods.
People love to watch, read and interact with quality content — especially video content. Whether it is sports, news, TV shows, or videos captured on smartphones, people crave digital content. The emergence of OTT platforms has already shaped the way people consume content. Viewers can now enjoy their favorite shows whenever they want rather than at pre-set times. Thus, the OTT platform’s concept of viewing anything, anytime, anywhere has hit the right chord.
Agile project management is a great alternative to traditional methods, to address the customer’s needs and the delivery of business value from the beginning of the project. This blog describes the main benefits of Agile for both the customer and the business.
The purpose of developing test cases is to ensure the application functions as expected for the customer. Test cases provide basic application documentation for every function, feature, and integrated connection. Test case development often detects defects in the design or missing requirements early in the development process. Additionally, well-written test cases provide internal documentation for all application processing. Test case development is an important part of determining software quality and keeping defects away from customers.
I routinely come across test strategy documents when working with customers. They are lengthy—100 pages or more—and packed with monotonous text that is routinely reused from one project to another. Yawn once more— the test halt and resume circumstances, the defect management procedure, entrance and exit criteria, unnecessary generic risks, and in fact, one often-used model replicates the requirements of textbook testing, from stress to systems integration.
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!!