def test_delete(): slt = SortedList(range(20)) slt._reset(4) slt._check() for val in range(20): slt.remove(val) slt._check() assert len(slt) == 0 assert slt._maxes == [] assert slt._lists == []
def test_remove(): slt = SortedList() assert slt.discard(0) == None assert len(slt) == 0 slt._check() slt = SortedList([1, 2, 2, 2, 3, 3, 5]) slt._reset(4) slt.remove(2) slt._check() assert all(tup[0] == tup[1] for tup in zip(slt, [1, 2, 2, 3, 3, 5]))
def test_remove_valueerror3(): slt = SortedList([1, 2, 2, 2, 3, 3, 5]) with pytest.raises(ValueError): slt.remove(4)
def test_remove_valueerror2(): slt = SortedList(range(100)) slt._reset(10) with pytest.raises(ValueError): slt.remove(100)
def test_remove_valueerror1(): slt = SortedList() with pytest.raises(ValueError): slt.remove(0)