def test_primitives():
    dictionnary = Dictionnary()
    with pytest.raises(NotImplementedError):
        dictionnary.search(key=0)
    with pytest.raises(NotImplementedError):
        dictionnary.insert(KeyedItem(0, 0))
    with pytest.raises(NotImplementedError):
        dictionnary.delete(KeyedItem(0, 0))
    with pytest.raises(NotImplementedError):
        dictionnary.max()
    with pytest.raises(NotImplementedError):
        dictionnary.min()
    with pytest.raises(NotImplementedError):
        dictionnary.predecessor(KeyedItem(0, 0))
    with pytest.raises(NotImplementedError):
        dictionnary.successor(KeyedItem(0, 0))
def test_predecessor_successor_balanced_tree():
    dictionnary = Dictionnary(implementation='balanced_tree')
    item_0 = KeyedItem(key=0, content=0)
    item_1 = KeyedItem(key=1, content=1)
    item_2 = KeyedItem(key=2, content=2)
    item_3 = KeyedItem(key=3, content=3)
    dictionnary.insert(item_0)
    dictionnary.insert(item_1)
    dictionnary.insert(item_2)
    dictionnary.insert(item_3)
    assert dictionnary.predecessor(item_0) is None
    assert dictionnary.predecessor(item_1) is item_0
    assert dictionnary.predecessor(item_2) is item_1
    assert dictionnary.predecessor(item_3) is item_2
    assert dictionnary.successor(item_0) is item_1
    assert dictionnary.successor(item_1) is item_2
    assert dictionnary.successor(item_2) is item_3
    assert dictionnary.successor(item_3) is None