(expected, submitted_elements)
return (
        "Expected:\n"
        + "        {}\n".format(expected)
        + "Similar submitted:\n"
        + "Score   Most similar\n"
        + "\n".join(similar_metrics_to_print)
    )
Return formatted similar elements (metrics, service checks) received compared to submitted elements
Return formatted similar elements (metrics, service checks) received compared to submitted elements
Return formatted similar elements ( metrics service checks ) received compared to submitted elements
def build_similar_elements_msg(expected, submitted_elements):
    """
    Return formatted similar elements (metrics, service checks) received compared to submitted elements
    """

    similar_metrics = _build_similar_elements(expected, submitted_elements)
    similar_metrics_to_print = []

    for score, metric_stub in similar_metrics[:MAX_SIMILAR_TO_DISPLAY]:
        if metric_stub.tags:
            metric_stub.tags.sort()
        similar_metrics_to_print.append("{:.2f}    {}".format(score, metric_stub))

    return (
        "Expected:\n"
        + "        {}\n".format(expected)
        + "Similar submitted:\n"
        + "Score   Most similar\n"
        + "\n".join(similar_metrics_to_print)
    )
def build_similar_elements_msg ( expected , submitted_elements ) : similar_metrics = _build_similar_elements ( expected , submitted_elements ) similar_metrics_to_print = [ ] for score , metric_stub in similar_metrics [ : MAX_SIMILAR_TO_DISPLAY ] : if metric_stub . tags : metric_stub . tags . sort ( ) similar_metrics_to_print . append ( "{:.2f}    {}" . format ( score , metric_stub ) ) return ( "Expected:\n" + "        {}\n" . format ( expected ) + "Similar submitted:\n" + "Score   Most similar\n" + "\n" . join ( similar_metrics_to_print ) )