def occurrences(t):
    """renvoie le dictionnaire des occurrences de t"""
    d = {}
    for x in t:
        if x in d:
            d[x] += 1
        else:
            d[x] = 1
    return d

def identiques(d1, d2):
    """deux dictionnaires sont identiques"""
    for x in d1:
        assert x in d2
        assert d1[x] == d2[x]
    for x in d2:
        assert x in d1
        assert d2[x] == d1[x]

def test(t):
    """teste la fonction tri sur le tableau t"""
    occ = occurrences(t)
    tri(t)
    for i in range(0, len(t) - 1):
        assert t[i] <= t[i+1]
    identiques(occ, occurrences(t))