def ud_perm_inv(rank): return [i + 7 for i in (Permutation.from_lehmer(rank, 4)).to_image(4)]
def test_bad_from_lehmer(lehmer, degree): with pytest.raises(ValueError): Permutation.from_lehmer(lehmer, degree)
def eg_perm_inv(rank): return [i - 1 for i in (Permutation.from_lehmer(rank, 8)).to_image(8)]
def test_from_lehmer(p, degree, lehmer): assert Permutation.from_lehmer(lehmer, degree) == p