def METHOD_NAME(rule, slack_length):
    name = rule.__name__
    sequence = rule(slack_length)
    gates = [X if i == "x" else Y for i in name]
    gate_set = {X, Y}
    seq_gates = [op.gate for op in sequence.all_operations()]
    assert len(sequence) == slack_length
    assert gates == [gate for gate in seq_gates if gate in gate_set]