How to use find_sections method in yandex-tank

Best Python code snippet using yandex-tank

test_peaks.py

Source:test_peaks.py Github

copy

Full Screen

...81 """82 83 Performs unit testing on find_sections84 """85 def test_find_sections(self):86 #setup 87 print("testing find sectionds")88 #Null Case89 self.assertRaises(TypeError, find_sections, (None, 0))90 91 #Case with all zero coverage92 wiggle = [0] * 2093 result = find_sections(wiggle, 0)94 assert result == []95 96 #Case with all non-zero coverage97 wiggle = [5] * 2098 result = find_sections(wiggle, 0)99 self.assertEqual(result, [(0,19)])100 101 102 wiggle = ([5] * 20) + [0] + ([5] * 20)103 #returns one segnment104 result = find_sections(wiggle, 1)105 self.assertEqual(result, [(0,40)])106 107 #second case returns two segnments108 wiggle = ([5] * 9) + [0] + ([5] * 10)109 result = find_sections(wiggle, 0)110 assert result == [(0,9), (10,19)]111 112 #returns one segnment113 result = find_sections(wiggle, 1)114 assert result == [(0,19)]115 116 #Edge case where margins stop before the end of genes117 wiggle = [0] + ([5] * 10)118 result = find_sections(wiggle, 0)119 assert result == [(1,10)]120 121 #Edge case where margins start after the start of genes122 wiggle = ([5] * 10) + [0] 123 result = find_sections(wiggle, 0)124 assert result == [(0,10)]125 126 #Test not integers127 wiggle = [.5] * 20128 result = find_sections(wiggle, 0)129 self.assertEqual(result, [(0,19)])130 131 #test numpy arrays132 wiggle = ones((20), dtype='f')133 wiggle = list(wiggle)134 result = find_sections(wiggle, 0)135 self.assertEqual(result, [(0,19)])136 137 138 """139 140 Verifieis that find sections returns no overlapping sections 141 142 """143 def test_find_sections_no_overlaps(self):144 #verify there is no overlap145 146 wiggle = [10, 4,147 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 148 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 149 3, 3, 3, 3]150 result = find_sections(wiggle, 15)151 print(result)152 #start is greater than end153 self.assertGreater(result[1][0], result[0][1], "first region: %s, second region %s, start of section value is less than end of first" %(result[0][1], result[1][0] )) 154 155 """156 157 Tests what happens when there is a gap of one and no margin, should create two sections158 159 """160 def test_find_sections_two_sections(self):161 #Case with one region on margin of one and two regions on margin of two162 163 #returns two segnments164 wiggle = ([5] * 20) + [0] + ([5] * 20)165 result = find_sections(wiggle, 0)166 167 168 #I believe this is zero based half open result. Need to think about it more169 self.assertEqual(result, [(0,20), (21,40)])170 171 """172 173 Verifies that junction reads are properly calclulated in readsToWiggle_pysam174 175 """176 def test_readsToWiggle_pysam_jxnsOnly(self):177 pass178 #reads2 = pysam.Samfile(clipper.test_file("jxns.bam"))179 #reads2 = reads2.fetch(region="chr1:183806493-183836600")...

Full Screen

Full Screen

test_road_detection.py

Source:test_road_detection.py Github

copy

Full Screen

...14 return xodr_map15def test_find_neighbor_sections_0_right():16 point = (380.0, 2.0)17 xodr_map = load_town_01()18 neighbors = xodr_map.find_sections(point)19 _, is_right_road, road = neighbors[0]20 assert is_right_road and road.road_id == 021def test_find_neighbor_sections_0_left():22 point = (380.0, -2.0)23 xodr_map = load_town_01()24 neighbors = xodr_map.find_sections(point)25 _, is_right_road, road = neighbors[0]26 assert not is_right_road and road.road_id == 027def test_find_neighbor_sections_12_right():28 point = (245.85, -198.75)29 xodr_map = load_town_01()30 neighbors = xodr_map.find_sections(point)31 _, is_right_road, road = neighbors[0]32 assert is_right_road and road.road_id == 1233def test_find_neighbor_sections_12_left():34 point = (245.85, -195.75)35 xodr_map = load_town_01()36 neighbors = xodr_map.find_sections(point)37 _, is_right_road, road = neighbors[0]38 assert not is_right_road and road.road_id == 1239def test_find_neighbor_sections_curvature_one_sided_right():40 point = (92.00, -207.0)41 xodr_map = load_town_01()42 neighbors = xodr_map.find_sections(point)43 road_ids = [n[2].road_id for n in neighbors]44 assert 257 not in road_ids and 271 not in road_ids and \45 256 in road_ids and 272 in road_ids46def test_find_neighbor_sections_curvature_one_sided_left():47 point = (88.0, -207.0)48 xodr_map = load_town_01()49 neighbors = xodr_map.find_sections(point)50 road_ids = [n[2].road_id for n in neighbors]51 assert 257 in road_ids and 271 in road_ids and \52 256 not in road_ids and 272 not in road_ids53def test_find_neighbor_sections_5():54 point = (150.99, -57.5)55 xodr_map = load_town_01()56 neighbors = xodr_map.find_sections(point)57 road_ids = [n[2].road_id for n in neighbors]58 assert 334 in road_ids and 355 in road_ids and 333 not in road_ids59def test_find_neighbor_sections_town04_highway_1():60 point = (406.0252685546875, 124.70137786865234)61 xodr_map = load_town_04()62 neighbors = xodr_map.find_sections(point)63 lane_id, _, road = neighbors[0]64 assert road.road_id == 36 and lane_id == 465def test_find_neighbor_sections_town04_highway_2():66 point = (7.50634155273438, 130.54249572753906)67 xodr_map = load_town_04()68 neighbors = xodr_map.find_sections(point)69 road_ids = [n[2].road_id for n in neighbors]70 print(road_ids)71 assert road_ids == [48]72def test_find_neighbor_sections_town04_highway_3():73 point = (-105.50200653076172, -12.80552864074707)74 xodr_map = load_town_04()75 neighbors = xodr_map.find_sections(point)76 road_ids = [n[2].road_id for n in neighbors]77 print(road_ids)78 assert road_ids == [1184]79# def test_find_neighbor_sections_town04_highway_4():80# point = (248.52882111040037, 395.729771257481)81# xodr_map = load_town_04()82# neighbors = xodr_map.find_sections(point)83# road_ids = [n[2].road_id for n in neighbors]84# lane_polygons = [(road_id, lane_id, xodr_map.roads_by_id[road_id].lane_polygons[lane_id])85# for road_id in xodr_map.roads_by_id86# for lane_id in xodr_map.roads_by_id[road_id].lane_polygons]87# print('closeby polygons:', [(road_id, lane_id)88# for road_id, lane_id, polygon_points in lane_polygons89# if any(map(lambda p: dist(p, point) < 2, polygon_points))])90# print(road_ids)91# assert False# road_ids == [6]92 93# def test_find_neighbor_sections_town04_highway_4():94# point = (-504.7949523925781, -221.73223876953125)95# neighbors = RoadDetection.find_sections(point, load_town_04())96# road_ids = [n[2].road_id for n in neighbors]97# print(road_ids)98# assert road_ids == [6]99# def test_find_neighbor_sections_town04_highway_5():100# point = (1.5099804401397705, -249.42999267578125)101# neighbors = RoadDetection.find_sections(point, load_town_04())102# road_ids = [n[2].road_id for n in neighbors]103# print(road_ids)104# assert road_ids == [46]105# Test target points Town04: 106# (182.08697509765625, 395.9513244628906) Lanechange fuckup107# End Point not found108# [(16.488210678100586, -212.6156005859375), (375.6085205078125, 68.68538665771484),109# (86.74788665771484, -9.935043334960938), (-515.2499389648438, -240.95675659179688),110# (348.0001525878906, 142.8535614013672), (160.5265655517578, 389.1396789550781),111# (136.9810028076172, -209.24661254882812)]112# (-16.895854949951172, 212.5471954345703) Crash into wall113# Town 03114# End Point not found115# (1.1732555627822876, -69.5572509765625), (86.20638275146484, -7.808422565460205)

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 yandex-tank 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