本文整理汇总了Python中sentry.interfaces.exception.SingleException类的典型用法代码示例。如果您正苦于以下问题:Python SingleException类的具体用法?Python SingleException怎么用?Python SingleException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SingleException类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_only_requires_only_type_or_value
def test_only_requires_only_type_or_value(self):
SingleException.to_python(dict(
type='ValueError',
))
SingleException.to_python(dict(
value='ValueError',
))
示例2: test_handles_type_in_value
def test_handles_type_in_value(self):
result = SingleException.to_python(dict(value="ValueError: unauthorized"))
assert result.type == "ValueError"
assert result.value == "unauthorized"
result = SingleException.to_python(dict(value="ValueError:unauthorized"))
assert result.type == "ValueError"
assert result.value == "unauthorized"
示例3: test_handles_type_in_value
def test_handles_type_in_value(self):
result = SingleException.to_python(dict(
value='ValueError: unauthorized',
))
assert result.type == 'ValueError'
assert result.value == 'unauthorized'
result = SingleException.to_python(dict(
value='ValueError:unauthorized',
))
assert result.type == 'ValueError'
assert result.value == 'unauthorized'
示例4: test_value_serialization_idempotent
def test_value_serialization_idempotent(self):
result = SingleException.to_python({
'type': None,
'value': {'unauthorized': True},
}).to_json()
assert result['type'] is None
assert result['value'] == '{"unauthorized":true}'
# Don't re-split a json-serialized value on the colon
result = SingleException.to_python(result).to_json()
assert result['type'] is None
assert result['value'] == '{"unauthorized":true}'
示例5: test_throws_away_empty_stacktrace
def test_throws_away_empty_stacktrace(self):
result = SingleException.to_python(dict(
type='ValueError',
value='foo',
stacktrace={'frames': []},
))
assert not result.stacktrace
示例6: interface
def interface(self):
return SingleException.to_python(
dict(
type='ValueError',
value='hello world',
module='foo.bar',
)
)
示例7: test_coerces_object_value_to_string
def test_coerces_object_value_to_string(self):
result = SingleException.to_python(dict(
type='ValueError',
value={'unauthorized': True},
))
assert result.value == '{"unauthorized":true}'
示例8: interface
def interface(self):
return SingleException.to_python(dict(type="ValueError", value="hello world", module="foo.bar"))
示例9: test_throws_away_empty_stacktrace
def test_throws_away_empty_stacktrace(self):
result = SingleException.to_python(dict(type="ValueError", value="foo", stacktrace={"frames": []}))
assert not result.stacktrace
示例10: test_coerces_object_value_to_string
def test_coerces_object_value_to_string(self):
result = SingleException.to_python({
'type': 'ValueError',
'value': {'unauthorized': True},
})
assert result.value == '{"unauthorized":true}'