Best Python code snippet using green
test02_ cloudapi__machines.py
Source:test02_ cloudapi__machines.py
1#2#3# class Machines():4#5# def test01_Show_Hide(self):6# pass7#8# def test02_List_Operations(self):9# pass10#11# def test03_Expand_Operations(self):12# pass13#14# def test00_post_get_machines_get(self):15# """16# *Test case for get machine.*17#18# **Test Scenario:**19#20# #. get machine, should succeed21# """22# pass23#24# def test00_post_get_machines_list(self):25# """26# *Test case for list machine.*27#28# **Test Scenario:**29#30# #. list machine, should succeed31# """32# pass33#34# def test00_post_get_machines_getConsoleUrl(self):35# """36# *Test case for getConsoleUrl machine.*37#38# **Test Scenario:**39#40# #. getConsoleUrl machine, should succeed41# """42# pass43#44# def test00_post_get_machines_listSnapshots(self):45# """46# *Test case for listSnapshots machine.*47#48# **Test Scenario:**49#50# #. listSnapshots machine, should succeed51# """52# pass53#54# def test00_post_get_machines_getHistory(self):55# """56# *Test case for getHistory machine.*57#58# **Test Scenario:**59#60# #. getHistory machine, should succeed61# """62# pass63#64# def test00_post_get_machines_stop(self):65# """66# *Test case for stop machine.*67#68# **Test Scenario:**69#70# #. stop machine, should succeed71# """72# pass73#74# def test00_post_get_machines_start(self):75# """76# *Test case for start machine.*77#78# **Test Scenario:**79#80# #. start machine, should succeed81# """82# pass83#84# def test00_post_get_machines_reboot(self):85# """86# *Test case for reboot machine.*87#88# **Test Scenario:**89#90# #. reboot machine, should succeed91# """92# pass93#94# def test00_post_get_machines_reset(self):95# """96# *Test case for reset machine.*97#98# **Test Scenario:**99#100# #. reset machine, should succeed101# """102# pass103#104# def test00_post_get_machines_pause(self):105# """106# *Test case for pause machine.*107#108# **Test Scenario:**109#110# #. pause machine, should succeed111# """112# pass113#114# def test00_post_get_machines_resume(self):115# """116# *Test case for resume machine.*117#118# **Test Scenario:**119#120# #. resume machine, should succeed121# """122# pass123#124# def test00_post_get_machines_snapshot(self):125# """126# *Test case for snapshot machine.*127#128# **Test Scenario:**129#130# #. snapshot machine, should succeed131# """132# pass133#134# def test00_post_get_machines_deleteSnapshot(self):135# """136# *Test case for deleteSnapshot machine.*137#138# **Test Scenario:**139#140# #. deleteSnapshot machine, should succeed141# """142# pass143#144# def test00_post_get_machines_rollbackSnapshot(self):145# """146# *Test case for getHistory machine.*147#148# **Test Scenario:**149#150# #. rollbackSnapshot machine, should succeed151# """152# pass153#154# def test00_post_get_machines_attachPublicNetwork(self):155# """156# *Test case for attachPublicNetwork machine.*157#158# **Test Scenario:**159#160# #. attachPublicNetwork machine, should succeed161# """162# pass163#164# def test00_post_get_machines_detachPublicNetwork(self):165# """166# *Test case for detachPublicNetwork machine.*167#168# **Test Scenario:**169#170# #. detachPublicNetwork machine, should succeed171# """172# pass173#174# def test00_post_get_machines_resize(self):175# """176# *Test case for resize machine.*177#178# **Test Scenario:**179#180# #. resize machine, should succeed181# """182# pass183#184# def test00_post_get_machines_addDisk(self):185# """186# *Test case for addDisk machine.*187#188# **Test Scenario:**189#190# #. addDisk machine, should succeed191# """192# pass193#194#195# def test00_post_get_machines_attachDisk(self):196# """197# *Test case for attachDisk machine.*198#199# **Test Scenario:**200#201# #. attachDisk machine, should succeed202# """203# pass204#205# def test00_post_get_machines_detachDisk(self):206# """207# *Test case for detachDisk machine.*208#209# **Test Scenario:**210#211# #. detachDisk machine, should succeed212# """213# pass214#215#216# def test00_post_get_machines_createTemplate(self):217# """218# *Test case for createTemplate machine.*219#220# **Test Scenario:**221#222# #. createTemplate machine, should succeed223# """224# pass225#226# def test00_post_get_machines_clone(self):227# """228# *Test case for clone machine.*229#230# **Test Scenario:**231#232# #. clone machine, should succeed233# """234# pass235#236# def test00_post_get_machines_create(self):237# """238# *Test case for create machine.*239#240# **Test Scenario:**241#242# #. create machine, should succeed243# """244# pass245#246# def test00_post_get_machines_update(self):247# """248# *Test case for update machine.*249#250# **Test Scenario:**251#252# #. update machine, should succeed253# """254# pass255#256# def test00_post_get_machines_delete(self):257# """258# *Test case for delete machine.*259#260# **Test Scenario:**261#262# #. delete machine, should succeed263# """264# pass265#266# def test00_post_get_machines_addUser(self):267# """268# *Test case for clone machine.*269#270# **Test Scenario:**271#272# #. addUser machine, should succeed273# """274# pass275#276#277# def test00_post_get_machines_updateUser(self):278# """279# *Test case for updateUser machine.*280#281# **Test Scenario:**282#283# #. updateUser machine, should succeed284# """285# pass286#287#288# def test00_post_get_machines_deleteUser(self):289# """290# *Test case for deleteUser machine.*291#292# **Test Scenario:**293#294# #. deleteUser machine, should succeed295# """296# pass297#298# def test00_post_get_machines_addExternalUser(self):299# """300# *Test case for addExternalUser machine.*301#302# **Test Scenario:**303#304# #. addExternalUser machine, should succeed305# """...
FaceRecognisionSample.py
Source:FaceRecognisionSample.py
1import cv22import numpy as np3import face_recognition4def faceRecognistionVersion01():5 imgFace00 = face_recognition.load_image_file("ImagesSample/richard.jpg")6 imgFace00 = cv2.cvtColor(imgFace00, cv2.COLOR_BGR2RGB)7 imgFaceTest00 = face_recognition.load_image_file("ImagesSample/richardTest.jpg")8 imgFaceTest00 = cv2.cvtColor(imgFaceTest00, cv2.COLOR_BGR2RGB)9 imgFace01 = face_recognition.load_image_file("ImagesSample/Face01.jpg")10 imgFace01 = cv2.cvtColor(imgFace01, cv2.COLOR_BGR2RGB)11 imgFace02 = face_recognition.load_image_file("ImagesSample/Face02.jpg")12 imgFace02 = cv2.cvtColor(imgFace02, cv2.COLOR_BGR2RGB)13 imgFace03 = face_recognition.load_image_file("ImagesSample/Face03.jpg")14 imgFace03 = cv2.cvtColor(imgFace03, cv2.COLOR_BGR2RGB)15 imgFace04 = face_recognition.load_image_file("ImagesSample/Face04.jpg")16 imgFace04 = cv2.cvtColor(imgFace04, cv2.COLOR_BGR2RGB)17 imgPeople01 = face_recognition.load_image_file("ImagesSample/TestPeople01.jpg")18 imgPeople01 = cv2.cvtColor(imgPeople01, cv2.COLOR_BGR2RGB)19 imgPeople02 = face_recognition.load_image_file("ImagesSample/TestPeople02.jpg")20 imgPeople02 = cv2.cvtColor(imgPeople02, cv2.COLOR_BGR2RGB)21 imgPeople03 = face_recognition.load_image_file("ImagesSample/TestPeople03.jpg")22 imgPeople03 = cv2.cvtColor(imgPeople03, cv2.COLOR_BGR2RGB)23 # faceLoc01 = face_recognition.face_locations(imgFace01)[0]24 # encodeFace01 = face_recognition.face_encodings(imgFace01)[0]25 # print(faceLoc01)26 # cv2.rectangle(imgFace01, (faceLoc01[3], faceLoc01[0]), (faceLoc01[1], faceLoc01[2]), (255, 255, 0), 3)27 faceLoc00 = face_recognition.face_locations(imgFace01)[0]28 encodeFace00 = face_recognition.face_encodings(imgFace01)[0]29 print(faceLoc00)30 cv2.rectangle(imgFace00, (faceLoc00[3], faceLoc00[0]), (faceLoc00[1], faceLoc00[2]), (255, 255, 0), 3)31 faceLocTest00 = face_recognition.face_locations(imgFaceTest00)[0]32 encodeFaceTest00 = face_recognition.face_encodings(imgFaceTest00)[0]33 print(faceLocTest00)34 cv2.rectangle(imgFaceTest00, (faceLocTest00[3], faceLocTest00[0]), (faceLocTest00[1], faceLocTest00[2]), (255, 255, 0), 3)35 results = face_recognition.compare_faces([encodeFace00], encodeFaceTest00)36 print(results)37 faceDis = face_recognition.face_distance([encodeFace00], encodeFaceTest00)38 print(faceDis)39 cv2.putText(imgFace00, f'{results} {faceDis}', (50, 50), cv2.FONT_HERSHEY_COMPLEX, 1, (0, 0, 255), 2)40 # peopleLoc01 = face_recognition.face_locations(imgPeople01)[0]41 # encodePeople01 = face_recognition.face_encodings(imgPeople01)[0]42 # print(peopleLoc01)43 # cv2.rectangle(imgPeople01, (peopleLoc01[3], peopleLoc01[0]), (peopleLoc01[1], peopleLoc01[2]), (255, 255, 0), 3)44 #cv2.imshow("Face 01", imgFace01)45 #cv2.imshow("People 01", imgPeople01)46 cv2.imshow("imgFace00", imgFace00)47 cv2.imshow("imgFaceTest00", imgFaceTest00)...
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!!