How to use test_3_2 method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

eval.py

Source:eval.py Github

copy

Full Screen

1from informed3 import informed_search2from uninformed import uninformed_search3import time4def performace():5 """6 Evaluate the performance of informed & uninformed search algorithms.7 8 Metrics:9 - time taken to run the search10 - length of the optimal path found11 """12 # Test input for 3*3 puzzle13 test_3_1 = [[1,2,3], [4,5,6], [8,7,0]]14 test_3_2 = [[1,8,3], [5,2,4], [0,7,6]]15 test_3_3 = [[8,6,7], [2,5,4], [3,0,1]]16 # Test input for 4*4 puzzle17 test_4_1 = [[1,2,3,4], [5,6,7,8], [10,11,0,12], [9,13,15,14]]18 test_4_2 = [[12,15,6,10], [4,9,5,8], [14,13,0,2], [1,7,11,3]]19 # test_4_3 = [[14,10,5,13], [11, 8, 1, 3], [2,9,12,6], [15,4,0,7]]20 test_4_3 = [[13, 5, 3, 4], [2, 1, 8, 0], [9, 15, 10, 11], [14, 12, 6, 7]]21 test_4_4 = [[9, 5, 12, 4], [0, 1, 3, 10], [14, 13, 11, 2], [15, 7, 6, 8]]22 # Test input for 5*5 puzzle23 # test_5_1 = [[1,2,3,4,5], [6,7,8,9,10], [11,12,0,14,15], [16,17,13,18,19], [21,22,23,20,24]]24 # test_5_2 = [[5,7,20,18,8], [14,16,4,23,3], [1,11,2,24,13], [21,10,19,0,17], [15,12,6,22,9]]25 # test_5_3 = [[21,12,8,18,20], [24,1,17,13,11], [22,4,19,9,5], [15,2,10,0,16], [7,23,6,14,3]]26 test_5_1 = [[1,2,3,4,5], [6,7,8,9,10], [11,12,0,14,15], [16,17,13,20,19], [21,22,23,18,24]]27 test_5_2 = [[1, 3, 4, 10, 5], [7, 2, 8, 0, 14], [6, 11, 12, 9, 15], [16, 17, 13, 18, 19], [21, 22, 23, 24, 20]]28 test_5_3 = [[1, 3, 4, 0, 10], [7, 2, 12, 8, 5], [6, 11, 13, 15, 14], [17, 23, 18, 9, 19], [16, 21, 22, 24, 20]]29 test_5_4 = [[1, 3, 4, 10, 5], [7, 2, 12, 8, 14], [6, 11, 13, 15, 0], [17, 23, 18, 9, 19], [16, 21, 22, 24, 20]]30 test_5_5 = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 14, 0, 15], [16, 17, 13, 18, 19], [21, 22, 23, 24, 20]]31 # Goal states32 goal_3 = [[1,2,3], [4,5,6], [7,8,0]]33 goal_4 = [[1,2,3,4], [5,6,7,8], [9,10,11,12], [13,14,15,0]]34 goal_5 = [[1,2,3,4,5], [6,7,8,9,10], [11,12,13,14,15], [16,17,18,19,20], [21,22,23,24,0]]35 # Test for uninformed search36 # timer(test_3_1, goal_3, "test_3_1", False)37 # timer(test_3_2, goal_3, "test_3_2", False)38 # timer(test_3_3, goal_3, "test_3_3", False)39 # timer(test_4_1, goal_4, "test_4_1", False)40 # timer(test_4_2, goal_4, "test_4_2", False)41 # timer(test_4_3, goal_4, "test_4_3", False)42 #timer(test_5_1, goal_5, "test_5_1", False)43 #timer(test_5_2, goal_5, "test_5_2", False)44 #timer(test_5_3, goal_5, "test_5_3", False)45 # Test for informed search46 # timer(test_3_1, goal_3, "test_3_1", True)47 # timer(test_3_2, goal_3, "test_3_2", True)48 # timer(test_3_3, goal_3, "test_3_3", True)49 timer(test_4_1, goal_4, "test_4_1", True)50 timer(test_4_2, goal_4, "test_4_2", True)51 timer(test_4_3, goal_4, "test_4_3", True)52 timer(test_4_4, goal_4, "test_4_4", True)53 # timer(test_5_1, goal_5, "test_5_1", True)54 # timer(test_5_2, goal_5, "test_5_2", True)55 # timer(test_5_3, goal_5, "test_5_3", True)56 # timer(test_5_4, goal_5, "test_5_4", True) 57 # timer(test_5_5, goal_5, "test_5_5", True)58def timer(test, goal, testname, is_informed):59 # record elapsed time60 start = time.time()61 if (not is_informed):62 run = uninformed_search(test, goal)63 else:64 run = informed_search(test, goal)65 end = time.time()66 print(testname + ": %.8f s" %(end - start))67 # record optimal path length found68 if (isinstance(run, list) and len(run) == 1 and run[0] == "UNSOLVABLE"):69 print("path length: UNSOLVABLE")70 else:71 print("path length: " + str(len(run)))72if __name__ == '__main__':...

Full Screen

Full Screen

junos-upgrade-testplan-3-2.py

Source:junos-upgrade-testplan-3-2.py Github

copy

Full Screen

1#!/usr/bin/python2from jnpr.junos import Device3from lxml import etree4import json5from jnpr.junos.utils.scp import SCP6from datetime import datetime7# dev_mgmt = { "vMX_RR-21" : "87.201.172.205" } 8dev_mgmt = { "KIF_VPN" : "10.117.97.56", 9 "HRZ_VPN" : "10.117.97.55", 10 "AMS_VPN" : "10.117.97.37", 11 "LON_VPN" : "10.117.97.36"12 } 13login_username = "ysaied"14test_3_2 = list()15test_3_2_1 = "show interfaces terse"16test_3_2_2 = "show ospf interface"17test_3_2_3 = "show ospf neighbor"18test_3_2_4 = "show ospf database"19test_3_2_5 = "show ted database"20test_3_2_6 = "show route protocol ospf"21test_3_2_7 = "show mpls interface"22test_3_2_8 = "show ldp interface"23test_3_2_9 = "show ldp neighbor"24test_3_2_10 = "show route table inet.3 protocol ldp"25test_3_2_11 = "show rsvp interface"26test_3_2_12 = "show rsvp neighbor"27test_3_2_13 = "show rsvp session"28test_3_2_14 = "show route table inet.3 protocol rsvp"29test_3_2_15 = "show mpls lsp ingress"30test_3_2_16 = "show bgp summary"31for a in range(1,17):32 show_cmd = vars()[("test_3_2_%d" % a)]33 test_3_2.append(show_cmd)34time_now = datetime.now().strftime("%A__%d-%h-%Y__%I:%M %p")35today = datetime.now().strftime("%d-%h-%Y")36show_all = test_3_237for src_node, mgmt_ip in dev_mgmt.items():38 39 file_name = src_node+"-"+"JUNOS-18_4R3-Upgrade_TestPlan_3_2-Date_"+today+"_outputs.txt"40 file_output = open(file_name, "w")41 print ("open file for %s" % src_node)42 43 dev = Device(host= mgmt_ip, user= login_username)44 dev.open()45 print >> file_output, ("#"*(len(src_node) + len(time_now) + 46))46 print >> file_output, ("\n" + "="*20 + " "*2 + src_node + " "*2 + time_now + " "*2 + "="*20)47 48 for show in show_all:49 print >> file_output, ("\n" + "="*5 + " "*2 + show + " @ " + src_node + " "*2 + "="*5) 50 try :51 output = dev.rpc.cli(show, format='text')52 if type(output) is bool:53 print >> file_output, ("NO Output Available !!!!")54 else:55 print >> file_output, (output.text)56 print ("\t progressing %s" % show)57 except:58 print >> file_output, ("NOT Supported command !!!!")59 60 print >> file_output, ("\n" + "="*(44+len(src_node)+len(time_now)) + "\n") 61 dev.close()62 file_output.close()...

Full Screen

Full Screen

test_prueba3_2.py

Source:test_prueba3_2.py Github

copy

Full Screen

1import unittest2from testing_function import testingFunction3import BGP_Simulator4class Test_3_2(unittest.TestCase):5 def test_3_2(self):6 testingFunction("input_tests/prueba3_2.json","output_tests/output_test3_2.txt", "relevant_output/test_3_2.txt")7 for router_to_check in BGP_Simulator.routers_dict:8 self.assertTrue(len(BGP_Simulator.routers_dict[router_to_check].rib) == 0)9 for router_in_rib_in in BGP_Simulator.routers_dict[router_to_check].rib_in:10 self.assertTrue(len(BGP_Simulator.routers_dict[router_to_check].rib_in[router_in_rib_in]) == 0)11 12 13if __name__ == 'main':...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Lemoncheesecake automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful