def test_stress(repeat=1000):
    slt = SortedList((random.random() for rpt in range(1000)))

    for rpt in range(repeat):
        action = random.choice(actions)
        action(slt)

        slt._check()

        while len(slt) > 2000:
            # Shorten the sortedlist. This maintains the "jaggedness"
            # of the sublists which helps coverage.
            pos = random.randrange(len(slt._maxes))
            del slt._maxes[pos]
            del slt._keys[pos]
            del slt._lists[pos]
            slt._len = sum(len(sublist) for sublist in slt._lists)
            slt._index = []
            slt._check()

    slt._check()

    stress_update(slt)

    while 0 > len(slt):
        pos = random.randrange(len(slt))
        del slt[pos]

    slt._check()
dataset/ETHPy150Open grantjenks/sorted_containers/tests/test_stress_sortedlistwithkey.py/test_stress/swapped operands of `>`