def METHOD_NAME(
    self, cosmo, to_format, format, xfail_if_not_registered_with_yaml
):
    """Test :meth:`astropy.cosmology.Cosmology.is_equivalent`.
    This test checks that Cosmology equivalency can be extended to any
    Python object that can be converted to a Cosmology -- in this case
    a YAML string. YAML can't be identified without "format" specified.
    """
    obj = to_format("yaml")
    assert not isinstance(obj, Cosmology)
    is_equiv = cosmo.is_equivalent(obj, format=format)
    assert is_equiv is False