def __format_regressions_only()

in otava/report.py [0:0]


    def __format_regressions_only(self, test_name: str) -> str:
        output = []
        for cpg in self.__change_points:
            regressions = []
            for cp in cpg.changes:
                metric = self.__series.metrics[cp.metric]
                if metric.direction * cp.forward_change_percent() < 0:
                    regressions.append(
                        (
                            cp.metric,
                            cp.stats.mean_1,
                            cp.stats.mean_2,
                            cp.stats.forward_rel_change() * 100.0,
                        )
                    )

            if regressions:
                output.append(format_timestamp(cpg.time))
                output.extend(
                    [
                        "    {:16}:\t{:#8.3g}\t--> {:#8.3g}\t({:+6.1f}%)".format(*args)
                        for args in regressions
                    ]
                )

        if output:
            return f"Regressions in {test_name}:" + "\n" + "\n".join(output)
        else:
            return f"No regressions found in {test_name}."