def test_profile(): profiler = Profiler() frame = foo() profiler._profile(frame, 'call', None) profiler._profile(frame, 'return', None) assert len(profiler.stats) == 1 stat1 = find_stat(profiler.stats, 'foo') stat2 = find_stat(profiler.stats, 'bar') stat3 = find_stat(profiler.stats, 'baz') assert stat1.calls == 0 assert stat2.calls == 0 assert stat3.calls == 1
def test_profile(): profiler = Profiler() frame = foo() profiler._profile(frame, 'call', None) profiler._profile(frame, 'return', None) assert len(profiler.stats) == 1 stat1 = find_stat(profiler.stats, 'foo') stat2 = find_stat(profiler.stats, 'bar') stat3 = find_stat(profiler.stats, 'baz') assert stat1.calls == 0 assert stat2.calls == 0 assert stat3.calls == 1
def test_profile(): profiler = Profiler() frame = mock_stacked_frame(map(mock_code, ['foo', 'bar', 'baz'])) profiler._profile(frame, 'call', None) profiler._profile(frame, 'return', None) assert len(profiler.stats) == 1 stat1 = find_stat(profiler.stats, 'baz') stat2 = find_stat(profiler.stats, 'bar') stat3 = find_stat(profiler.stats, 'foo') assert stat1.calls == 0 assert stat2.calls == 0 assert stat3.calls == 1