Exemplo n.º 1
0
    def test_formats_table(self):
        cfg = config.Config()
        r = reporter.ComparisonReporter(cfg)

        formatted = r.format_as_table([])
        # 1 header line, 1 separation line + 0 data lines
        self.assertEqual(1 + 1 + 0, len(formatted.splitlines()))

        # ["Metric", "Operation", "Baseline", "Contender", "Diff", "Unit"]
        metrics_table = [
            ["Min Throughput", "index", "17300", "18000", "700", "ops/s"],
            ["Median Throughput", "index", "17500", "18500", "1000", "ops/s"],
            ["Max Throughput", "index", "17700", "19000", "1300", "ops/s"]
        ]

        formatted = r.format_as_table(metrics_table)
        # 1 header line, 1 separation line + 3 data lines
        self.assertEqual(1 + 1 + 3, len(formatted.splitlines()))
Exemplo n.º 2
0
 def setUp(self):
     config_mock = mock.Mock(config.Config)
     config_mock.opts.return_value = True
     self.reporter = reporter.ComparisonReporter(config_mock)