def METHOD_NAME(filter_role):
    """Tests that the protocol to filter substances by
    role correctly works."""
    def create_substance():
        test_substance = Substance()
        test_substance.add_component(
            Component("C", role=Component.Role.Solute),
            ExactAmount(1),
        )
        test_substance.add_component(
            Component("CC", role=Component.Role.Ligand),
            ExactAmount(1),
        )
        test_substance.add_component(
            Component("CCC", role=Component.Role.Receptor),
            ExactAmount(1),
        )
        test_substance.add_component(
            Component("O", role=Component.Role.Solvent),
            MoleFraction(1.0),
        )
        return test_substance
    filter_protocol = FilterSubstanceByRole("filter_protocol")
    filter_protocol.input_substance = create_substance()
    filter_protocol.component_roles = [filter_role]
    filter_protocol.execute("", ComputeResources())
    assert len(filter_protocol.filtered_substance.components) == 1
    assert filter_protocol.filtered_substance.components[0].role == filter_role