Beispiel #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
Beispiel #2
0
 def test_get_rps_list(self, rps, duration, rps_list):
     assert Const(rps, duration).get_rps_list() == rps_list
     assert isinstance(rps_list[0][1], int)
Beispiel #3
0
 def test_rps_at(self, rps, duration, rps_list, check_point, expected):
     assert Const(rps, duration).rps_at(check_point(duration)) == expected(rps)