Exemplo n.º 1
0
def time(store):
    tm = TreeMap()
    for i in store:
        tm.put(i, i)
    start = time_ns()
    for i in store:
        tm.remove(i)
    end = time_ns()
    return end - start
Exemplo n.º 2
0
def test():
    m1 = TreeMap(none_at_end)
    assert m1.put('a', 'a') is None
    assert m1.put('b', 'b') is None
    assert m1.put('c', 'c') is None
    assert m1.put(None, 'd') is None

    m2 = TreeMap(none_at_end)
    m2.put_all(m1)

    assert m1.last_key() is None
    assert m1.get(m1.last_key()) == 'd'
    assert m1.remove(m1.last_key()) == 'd'
    assert m1.last_key() == 'c'

    assert m2.entry_set().to_string() == '[a=a, b=b, c=c, None=d]'

    m3 = m2.tail_map('b')

    assert m3.last_key() is None
    assert m3.get(m3.last_key()) == 'd'
    assert m3.remove(m3.last_key()) == 'd'
    assert m3.last_key() == 'c'