def test_sample_data_over_time_1():
    time = MockedTime()
    percentile = RollingPercentile(time, 60000, 12, 1000, True)
    previous_time = 0
    for time_millis, latency in sample_data_holder_1:
        time.increment(time_millis - previous_time)
        previous_time = time_millis
        percentile.add_value(latency)

    print('0.01', percentile.percentile(0.01))
    print('Median', percentile.percentile(50))
    print('90th', percentile.percentile(90))
    print('99th', percentile.percentile(99))
    print('99.5th', percentile.percentile(99.5))
    print('99.99', percentile.percentile(99.99))

    print('Median', percentile.percentile(50))
    print('Median', percentile.percentile(50))
    print('Median', percentile.percentile(50))

    # In a loop as a use case was found where very different values were
    # calculated in subsequent requests.
    for _ in range(10):
        percentile50 = percentile.percentile(50)
        if percentile50 > 5:
            pytest.fail('We expect around 2 but got: {}'.format(percentile50))

        percentile995 = percentile.percentile(99.5)
        if 20 < percentile995:
            msg = 'We expect to see some high values over 20 but got: {}'
            pytest.fail(msg.format(percentile995))
dataset/ETHPy150Open wiliamsouza/hystrix-py/tests/test_rolling_percentile.py/test_sample_data_over_time_1/swapped operands of `<`