How to use test_3_3 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-3.py

Source:junos-upgrade-testplan-3-3.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_3 = list()15test_3_3_1 = "show route table l3vpn-option_a-%d"16test_3_3_2 = "show route table l3vpn-option_c-%d"17test_3_3_3 = "show l2vpn connections"18test_3_3_4 = "show l2circuit connections"19test_3_3_5 = "show vpls connections"20test_3_3_6 = "show vpls mac-table"21for l3vpn_a in range(101,106):22 test_3_3.append(test_3_3_1 % l3vpn_a)23for l3vpn_c in range(111,116):24 test_3_3.append(test_3_3_2 % l3vpn_c)25for a in range(3,6):26 show_cmd = vars()[("test_3_3_%d" % a)]27 test_3_3.append(show_cmd)28time_now = datetime.now().strftime("%A__%d-%h-%Y__%I:%M %p")29today = datetime.now().strftime("%d-%h-%Y")30show_all = test_3_331for src_node, mgmt_ip in dev_mgmt.items():32 33 file_name = src_node+"-"+"JUNOS-18_4R3-Upgrade_TestPlan_3_3-Date_"+today+"_outputs.txt"34 file_output = open(file_name, "w")35 print ("open file for %s" % src_node)36 37 dev = Device(host= mgmt_ip, user= login_username)38 dev.open()39 print >> file_output, ("#"*(len(src_node) + len(time_now) + 46))40 print >> file_output, ("\n" + "="*20 + " "*2 + src_node + " "*2 + time_now + " "*2 + "="*20)41 42 for show in show_all:43 print >> file_output, ("\n" + "="*5 + " "*2 + show + " @ " + src_node + " "*2 + "="*5) 44 try :45 output = dev.rpc.cli(show, format='text')46 if type(output) is bool:47 print >> file_output, ("NO Output Available !!!!")48 else:49 print >> file_output, (output.text)50 print ("\t progressing %s" % show)51 except:52 print >> file_output, ("NOT Supported command !!!!")53 54 print >> file_output, ("\n" + "="*(44+len(src_node)+len(time_now)) + "\n") 55 dev.close()56 file_output.close()...

Full Screen

Full Screen

test_cases.py

Source:test_cases.py Github

copy

Full Screen

...38 def test_3_1(self):39 self.assertEqual(lca(node_9, node_5), node_2)40 def test_3_2(self):41 self.assertEqual(lca(node_8, node_5), node_2)42 def test_3_3(self):43 self.assertEqual(lca(node_8, node_4), node_4)44 def test_3_4(self):45 self.assertEqual(lca(node_3, node_7), node_3)46 def test_3_3(self):47 self.assertEqual(lca(node_6, node_1), node_1)48if __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