def test_format_report_empty(): b = BenchmarkTimer() rows = b.get_report() output = format_report(rows) lines = output.split("\n") assert len(lines) == 2 # headings, ---
def test_run_one(): b = BenchmarkTimer() b.start("This is a test") b.end() rows = b.get_report() assert len(rows) == 1
def test_format_report_one(): b = BenchmarkTimer() b.start("This is a test") b.end() rows = b.get_report() output = format_report(rows) lines = output.split("\n") assert len(lines) == 3 # headings, ---, message
def test_report_fields(): b = BenchmarkTimer() b.start("This is a test") b.end() b.start("This is another test") b.end() rows = b.get_report() first_row = rows[0] for k in "message amount min max avg".split(" "): yield check_report_field, first_row, k
def test_blank_report(): b = BenchmarkTimer() rows = b.get_report() assert len(rows) == 0
widget.show() view.colours = get_colours(widget, view.document.tokenizer.lexer, colourscheme) offset = (0, 0) size = view.textbox_dimensions tab_size = 8 b = BenchmarkTimer() for x in xrange(1000): b.start("Warmup (must relex)") view.document.invalidate((0, 0)) view.document.update_tokens(offset, size) layout = make_pango_layout(view, widget) b.end() for x in xrange(1000): b.start("Normal (no lexing)") view.document.update_tokens(offset, size) layout = make_pango_layout(view, widget) b.end() print report = b.get_report() print format_report(report)