def test_percentile_algorithm_extremes():
    ''' Unsorted so it is expected to sort it for us. '''
    snapshot = PercentileSnapshot(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
                                  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
                                  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
                                  800, 768, 657, 700, 867)

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

    assert snapshot.percentile(50) == 2
    assert snapshot.percentile(10) == 2
    assert snapshot.percentile(75) == 2

    if snapshot.percentile(95) < 600:
        msg = 'We expect 90th to be over 600 to show the extremes but got: {}'
        pytest.fail(msg.format(snapshot.percentile(95)))

    if 600 < snapshot.percentile(99):
        msg = 'We expect 99th to be over 600 to show the extremes but got: {}'
        pytest.fail(msg.format(snapshot.percentile(99)))
dataset/ETHPy150Open wiliamsouza/hystrix-py/tests/test_rolling_percentile.py/test_percentile_algorithm_extremes/swapped operands of `<`