def test_format_durations(): durations = {'foo': 1, 'bar': 2, 'quux': 3} msg = Run.format_durations(durations, 2) expected = textwrap.dedent("""\ =========== ================ benchmark total duration ----------- ---------------- quux 3.00s bar 2.00s ... ... total 6.00s =========== ================""") assert msg == expected