本文整理汇总了Python中sentry.interfaces.Stacktrace类的典型用法代码示例。如果您正苦于以下问题:Python Stacktrace类的具体用法?Python Stacktrace怎么用?Python Stacktrace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Stacktrace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_hash_ignores_filename_if_https
def test_get_hash_ignores_filename_if_https(self):
interface = Stacktrace(frames=[{
'context_line': 'hello world',
'filename': 'https://foo.com/foo.py',
}])
result = interface.get_hash()
self.assertEquals(result, ['hello world'])
示例2: test_serialize_returns_frames
def test_serialize_returns_frames(self):
interface = Stacktrace(frames=[{
'lineno': 1,
'filename': 'foo.py',
}])
result = interface.serialize()
self.assertTrue('frames' in result)
示例3: test_get_composite_hash_uses_exception_value_if_no_type_or_stack
def test_get_composite_hash_uses_exception_value_if_no_type_or_stack(self):
interface = Stacktrace(frames=[])
interface_exc = Exception(value='bar')
result = interface.get_composite_hash({
'sentry.interfaces.Exception': interface_exc,
})
self.assertEquals(result[-1], 'bar')
示例4: test_get_hash_with_only_required_vars
def test_get_hash_with_only_required_vars(self):
interface = Stacktrace(frames=[{
'lineno': 1,
'filename': 'foo.py',
}])
result = interface.get_hash()
self.assertEquals(result, ['foo.py', 1])
示例5: test_get_composite_hash_uses_exception_if_present
def test_get_composite_hash_uses_exception_if_present(self):
interface = Stacktrace(
frames=[{"context_line": "foo bar", "lineno": 1, "filename": "foo.py", "function": "bar"}]
)
interface_exc = Exception(type="exception", value="bar")
result = interface.get_composite_hash({"sentry.interfaces.Exception": interface_exc})
self.assertEquals(result[-1], "exception")
示例6: test_to_html_response
def test_to_html_response(self, get_traceback):
event = mock.Mock(spec=Event())
event.message = 'foo'
get_traceback.return_value = 'bar'
interface = Stacktrace(frames=[{'lineno': 1, 'filename': 'foo.py'}])
result = interface.to_html(event)
get_traceback.assert_called_once_with(event, newest_first=False)
self.assertTrue('<div class="module">' in result)
示例7: test_get_hash_uses_module_over_filename
def test_get_hash_uses_module_over_filename(self):
interface = Stacktrace(frames=[{
'lineno': 1,
'filename': 'foo.py',
'module': 'foo'
}])
result = interface.get_hash()
self.assertEquals(result, ['foo', 1])
示例8: test_get_hash_uses_function_over_lineno
def test_get_hash_uses_function_over_lineno(self):
interface = Stacktrace(frames=[{
'lineno': 1,
'filename': 'foo.py',
'function': 'bar'
}])
result = interface.get_hash()
self.assertEquals(result, ['foo.py', 'bar'])
示例9: test_get_traceback_response
def test_get_traceback_response(self, get_stacktrace):
event = mock.Mock(spec=Event())
event.message = "foo"
get_stacktrace.return_value = "bar"
interface = Stacktrace(frames=[{"lineno": 1, "filename": "foo.py"}])
result = interface.get_traceback(event)
get_stacktrace.assert_called_once_with(event, newest_first=None)
self.assertEquals(result, "foo\n\nbar")
示例10: test_get_traceback_response
def test_get_traceback_response(self, get_stacktrace):
event = mock.Mock(spec=Event)
event.message = 'foo'
get_stacktrace.return_value = 'bar'
interface = Stacktrace(frames=[])
result = interface.get_traceback(event)
get_stacktrace.assert_called_once_with(event)
self.assertEquals(result, 'foo\n\nbar')
示例11: test_get_hash_sanitizes_block_functions
def test_get_hash_sanitizes_block_functions(self):
# This is Ruby specific
interface = Stacktrace(frames=[{
'filename': 'foo.py',
'function': 'block in _conditional_callback_around_233',
}])
result = interface.get_hash()
self.assertEquals(result, ['foo.py', 'block'])
示例12: test_to_html_response
def test_to_html_response(self, get_traceback):
event = mock.Mock(spec=Event)
event.message = 'foo'
get_traceback.return_value = 'bar'
interface = Stacktrace(frames=[])
result = interface.to_html(event)
get_traceback.assert_called_once_with(event)
self.assertTrue('<div id="traceback" class="module">' in result)
示例13: test_get_hash_sanitizes_erb_templates
def test_get_hash_sanitizes_erb_templates(self):
# This is Ruby specific
interface = Stacktrace(frames=[{
'filename': 'foo.html.erb',
'function': '_foo_html_erb__3327151541118998292_70361296749460',
}])
result = interface.get_hash()
self.assertEquals(result, [
'foo.html.erb', '_foo_html_erb__<anon>_<anon>',
])
示例14: test_get_composite_hash_uses_exception_if_present
def test_get_composite_hash_uses_exception_if_present(self):
interface = Stacktrace(frames=[{
'context_line': 'foo bar',
'lineno': 1,
'filename': 'foo.py',
'function': 'bar'
}])
interface_exc = Exception(type='exception', value='bar')
result = interface.get_composite_hash({
'sentry.interfaces.Exception': interface_exc,
})
self.assertEquals(result[-1], 'exception')
示例15: test_to_html_render_call
def test_to_html_render_call(self, render_to_string, get_traceback):
event = mock.Mock(spec=Event)
get_traceback.return_value = 'bar'
interface = Stacktrace(frames=[])
result = interface.to_html(event)
get_traceback.assert_called_once_with(event)
render_to_string.assert_called_once_with('sentry/partial/interfaces/stacktrace.html', {
'event': event,
'frames': [],
'stacktrace': 'bar',
})
self.assertEquals(result, render_to_string.return_value)