[lang-ref] ( sort_by_value ) ( python )

def test_sort_by_value():
    d = { 'A': 3, 'B': 1, 'C': 2 }

    items = sorted(d.items(), key=lambda x: x[1])
    assert items == [('B', 1), ('C', 2), ('A', 3)]