def test_compute_stats_less_than_two_runs(profiler, profiled_func): num_runs = 1 with profiler.as_default(): for i in range(num_runs): profiled_func() stats = profiler.compute_stats()[get_func_id(profiled_func)] assert stats['min'] >= 0. assert stats['max'] > 0. assert stats['avg'] > 0. assert stats['tot'] > 0. assert stats['num'] == num_runs assert 'std' not in stats
def test_method_id(profiled_func): func_name = get_func_id(profiled_func) assert func_name == 'AnswerFactory.__call__'
def test_classmethod_id(profiled_func): func_name = get_func_id(profiled_func) assert func_name == 'AnswerFactory.get_answer_class'
def test_function_id(profiled_func): func_name = get_func_id(profiled_func) assert func_name == 'get_answer'