Esempio n. 1
0
class TestComposite(object):
    @pytest.mark.parametrize("steps, expected_len", [
        ([Line(0, 10, 20000), Const(10, 10000)], 200),
        ([Line(0, 10, 20000), Line(10, 0, 20000)], 200),
        ([Const(5, 10000), Const(10, 5000)], 100)
    ])
    def test_iter(self, steps, expected_len):
        assert len(Composite(steps)) == expected_len

    @pytest.mark.parametrize("steps, check_point, expected", [
        ([Line(0, 10, 20000), Const(10, 10000)], 9, (9, 2)),
        ([Line(0, 10, 20000), Const(10, 10000)], 10, (10, 2)),
        ([Line(0, 10, 20000), Const(10, 10000)], 11, (10, 10)),
    ])
    def test_rps_list(self, steps, check_point, expected):
        assert Composite(steps).get_rps_list()[check_point] == expected
Esempio n. 2
0
 def test_get_rps_list(self, min_rps, max_rps, duration, check_point, expected):
     assert Line(min_rps, max_rps, duration).get_rps_list()[check_point] == expected
Esempio n. 3
0
 def test_iter(self, min_rps, max_rps, duration, expected_len, threshold, len_above_threshold):
     load_plan = Line(min_rps, max_rps, duration)
     assert len(load_plan) == expected_len
     assert len([ts for ts in load_plan if ts >= threshold]) == len_above_threshold
Esempio n. 4
0
 def test_rps_at(self, min_rps, max_rps, duration, check_point, expected):
     assert round(Line(min_rps, max_rps, duration).rps_at(check_point)) == expected