Best Python code snippet using lemoncheesecake
test_left_join.py
Source:test_left_join.py
1import pytest2from .left_join import join3class TestLeftJoin:4 def test_proof_of_life(self):5 assert join6 @pytest.fixture7 def ht_1(self):8 ht_1 = {9 'test_1': 'synonym test_1',10 'test_2': 'synonym test_2',11 'test_3': 'synonym test_3',12 'test_4': 'synonym test_4',13 'test_5': 'synonym test_5',14 'test_6': 'synonym test_6',15 }16 return ht_117 @pytest.fixture18 def ht_2(self):19 ht_2 = {20 'test_2': 'antonym test_2',21 'test_3': 'antonym test_3',22 'test_6': 'antonym test_6',23 'test_7': 'antonym test_7',24 'test_8': 'antonym test_8',25 'test_9': 'antonym test_9',26 }27 return ht_228 def test_left_join_pass(self, ht_1, ht_2):29 expected = {30 'test_1': ('synonym test_1', None),31 'test_2': ('synonym test_2', 'antonym test_2'),32 'test_3': ('synonym test_3', 'antonym test_3'),33 'test_4': ('synonym test_4', None),34 'test_5': ('synonym test_5', None),35 'test_6': ('synonym test_6', 'antonym test_6'),36 }37 assert join(ht_1, ht_2) == expected38 def test_left_join_no_matches(self, ht_1):39 ht_2 = {40 'test_7': 'antonym test_7',41 'test_8': 'antonym test_8',42 'test_9': 'antonym test_9',43 }44 expected = {45 'test_1': ('synonym test_1', None),46 'test_2': ('synonym test_2', None),47 'test_3': ('synonym test_3', None),48 'test_4': ('synonym test_4', None),49 'test_5': ('synonym test_5', None),50 'test_6': ('synonym test_6', None),51 }52 assert join(ht_1, ht_2) == expected53 def test_left_join_empty_ht(self):54 ht_1 = ht_2 = {}55 assert join(ht_1, ht_2) == {}56 def test_right_join(self, ht_1, ht_2):57 expected = {58 'test_2': ('antonym test_2', 'synonym test_2'),59 'test_3': ('antonym test_3', 'synonym test_3'),60 'test_6': ('antonym test_6', 'synonym test_6'),61 'test_7': ('antonym test_7', None),62 'test_8': ('antonym test_8', None),63 'test_9': ('antonym test_9', None),64 }...
training_analysis.py
Source:training_analysis.py
1import json2import matplotlib.pyplot as plt3# Load all the history files4test_1 = json.load(open('Test_1/steer_history_full.json', 'r'))5test_2 = json.load(open('Test_2/steer_history_full.json', 'r'))6test_3 = json.load(open('Test_3/steer_history_full.json', 'r'))7test_4 = json.load(open('Test_4/steer_history_full.json', 'r'))8test_5 = json.load(open('Test_5/steer_history_full.json', 'r'))9test_6 = json.load(open('Test_6/steer_history_full.json', 'r'))10test_7 = json.load(open('Test_7/steer_history_full.json', 'r'))11test_8 = json.load(open('Test_8/steer_history_full.json', 'r'))12test_9 = json.load(open('Test_9/steer_history_full.json', 'r'))13test_10 = json.load(open('Test_10/steer_history_full.json', 'r'))14# Difference between batch sizes15plt.title('Model Loss Evolution')16plt.ylabel('Loss')17plt.xlabel('Iteration')18plt.plot(test_1['loss'][0:21])19plt.plot(test_2['loss'][0:21])20plt.legend(['Test 1 (batch size = 10)', 'Test 2 (batch size = 1000)'], loc='upper right')21plt.show()22# Performance of Network 123plt.title('Network 1 Loss Evolution')24plt.ylabel('Loss')25plt.xlabel('Iteration')26plt.plot(test_1['loss'])27plt.plot(test_2['loss'])28plt.plot(test_3['loss'])29plt.plot(test_4['loss'])30plt.legend(['Test 1', 'Test 2', 'Test 3', 'Test 4'], loc='upper right')31plt.show()32# Performance over the different networks33plt.title('Loss Evolution of all networks')34plt.ylabel('Loss')35plt.xlabel('Iteration')36plt.plot(test_1['loss'])37plt.plot(test_5['loss'])38plt.plot(test_6['loss'])39plt.plot(test_7['loss'])40plt.plot(test_8['loss'])41plt.plot(test_9['loss'])42plt.plot(test_10['loss'])43plt.legend(['Test 1 (Network 1)', 'Test 5 (Network 2)', 'Test 6 (Network 3)', 'Test 7 (Network 4)', 'Test 8 (Network 5)', 'Test 9 (Network 6)', 'Test 10 (Network 7)'], loc='upper right')44plt.show()45# Performance of Test 446plt.title('Test 4 Loss Evolution')47plt.ylabel('Loss')48plt.xlabel('Iteration')49plt.plot(range(0, 100), test_4['loss'])50plt.xticks(range(0,110,10))51plt.legend(['Test 4 (Network 1 with neutral frame drop implemented)'], loc='upper right')...
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!!