def METHOD_NAME(
    orig_label, ord_label, expected_reverted, bad_ord_label, use_fit_transform
):
    # prepare LabelEncoder
    le = LabelEncoder()
    if use_fit_transform:
        le.fit_transform(orig_label)
    else:
        le.fit(orig_label)
    assert le._fitted is True
    # test if inverse_transform is correct
    reverted = le.inverse_transform(ord_label)
    assert len(reverted) == len(expected_reverted)
    assert len(reverted) == len(reverted[reverted == expected_reverted])
    # test if correctly raies ValueError
    with pytest.raises(ValueError, match="y contains previously unseen label"):
        le.inverse_transform(bad_ord_label)