def test_over_max(self): values = [] data = {'values': values} for x in xrange(5): exc = {'value': 'exc %d' % x, 'stacktrace': {'frames': []}} values.append(exc) for y in xrange(5): exc['stacktrace']['frames'].append({ 'filename': 'frame %d' % y, 'vars': {}, 'pre_context': [], 'post_context': [], }) # slim to 10 frames to make tests easier slim_frame_data(data, 10) assert len(values) == 5 for e_num, value in enumerate(values): assert value['value'] == 'exc %d' % e_num assert len(value['stacktrace']['frames']) == 5 for f_num, frame in enumerate(value['stacktrace']['frames']): assert frame['filename'] == 'frame %d' % f_num if e_num in (0, 4): assert frame['filename'] == 'frame %d' % f_num assert frame['vars'] is not None assert frame['pre_context'] is not None assert frame['post_context'] is not None else: assert frame['filename'] == 'frame %d' % f_num assert 'vars' not in frame assert 'pre_context' not in frame assert 'post_context' not in frame
def test_under_max(self): value = {'values': [ {'value': 'foo', 'stacktrace': {'frames': [{'filename': 'foo'}]}, } ]} slim_frame_data(value) assert len(value['values'][0]['stacktrace']['frames']) == 1
def test_under_max(self): value = { 'values': [{ 'value': 'foo', 'stacktrace': { 'frames': [{ 'filename': 'foo' }] }, }] } slim_frame_data(value) assert len(value['values'][0]['stacktrace']['frames']) == 1