Best Python code snippet using yandex-tank
test_load_plan.py
Source:test_load_plan.py
...16 [(lambda duration: 0, lambda rps: rps),17 (lambda duration: duration / 2, lambda rps: rps),18 (lambda duration: duration + 1, lambda rps: 0),19 (lambda duration: -1, lambda rps: 0)])20 def test_rps_at(self, rps, duration, rps_list, check_point, expected):21 assert Const(rps,22 duration).rps_at(check_point(duration)) == expected(rps)23 def test_get_rps_list(self, rps, duration, rps_list):24 assert Const(rps, duration).get_rps_list() == rps_list25 assert isinstance(rps_list[0][1], int)26class TestLineNew(object):27 @pytest.mark.parametrize(28 "min_rps, max_rps, duration, check_point, expected",29 [(0, 10, 30 * 1000, 0, 0), (0, 10, 30 * 1000, 10, 3),30 (0, 10, 30 * 1000, 29, 10), (9, 10, 30 * 1000, 1, 9),31 (9, 10, 30 * 1000, 20, 10)])32 def test_rps_at(self, min_rps, max_rps, duration, check_point, expected):33 assert round(Line(min_rps, max_rps, duration).rps_at(34 check_point)) == expected35 @pytest.mark.parametrize(36 "min_rps, max_rps, duration, check_point, expected",37 [38 (0, 10, 20 * 1000, 9, (9, 2)),39 (0, 10, 30 * 1000, 0, (0, 2)),40 (0, 10, 30 * 1000, 5, (5, 3)),41 (0, 10, 30 * 1000, 10, (10, 2)),42 (0, 10, 3 * 1000, 0, (0, 1)),43 (0, 10, 3 * 1000, 1, (3, 1)),44 (0, 10, 3 * 1000, 2, (7, 1)),45 (0, 10, 3 * 1000, 3, (10, 1)),46 (9, 10, 30 * 1000, 0, (9, 15)),...
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!!