本文整理匯總了Python中sentry.interfaces.exception.SingleException.to_python方法的典型用法代碼示例。如果您正苦於以下問題:Python SingleException.to_python方法的具體用法?Python SingleException.to_python怎麽用?Python SingleException.to_python使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sentry.interfaces.exception.SingleException
的用法示例。
在下文中一共展示了SingleException.to_python方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_only_requires_only_type_or_value
# 需要導入模塊: from sentry.interfaces.exception import SingleException [as 別名]
# 或者: from sentry.interfaces.exception.SingleException import to_python [as 別名]
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
# 需要導入模塊: from sentry.interfaces.exception import SingleException [as 別名]
# 或者: from sentry.interfaces.exception.SingleException import to_python [as 別名]
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
# 需要導入模塊: from sentry.interfaces.exception import SingleException [as 別名]
# 或者: from sentry.interfaces.exception.SingleException import to_python [as 別名]
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
# 需要導入模塊: from sentry.interfaces.exception import SingleException [as 別名]
# 或者: from sentry.interfaces.exception.SingleException import to_python [as 別名]
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
# 需要導入模塊: from sentry.interfaces.exception import SingleException [as 別名]
# 或者: from sentry.interfaces.exception.SingleException import to_python [as 別名]
def test_throws_away_empty_stacktrace(self):
result = SingleException.to_python(dict(
type='ValueError',
value='foo',
stacktrace={'frames': []},
))
assert not result.stacktrace
示例6: interface
# 需要導入模塊: from sentry.interfaces.exception import SingleException [as 別名]
# 或者: from sentry.interfaces.exception.SingleException import to_python [as 別名]
def interface(self):
return SingleException.to_python(
dict(
type='ValueError',
value='hello world',
module='foo.bar',
)
)
示例7: test_coerces_object_value_to_string
# 需要導入模塊: from sentry.interfaces.exception import SingleException [as 別名]
# 或者: from sentry.interfaces.exception.SingleException import to_python [as 別名]
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
# 需要導入模塊: from sentry.interfaces.exception import SingleException [as 別名]
# 或者: from sentry.interfaces.exception.SingleException import to_python [as 別名]
def interface(self):
return SingleException.to_python(dict(type="ValueError", value="hello world", module="foo.bar"))
示例9: test_throws_away_empty_stacktrace
# 需要導入模塊: from sentry.interfaces.exception import SingleException [as 別名]
# 或者: from sentry.interfaces.exception.SingleException import to_python [as 別名]
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
# 需要導入模塊: from sentry.interfaces.exception import SingleException [as 別名]
# 或者: from sentry.interfaces.exception.SingleException import to_python [as 別名]
def test_coerces_object_value_to_string(self):
result = SingleException.to_python({
'type': 'ValueError',
'value': {'unauthorized': True},
})
assert result.value == '{"unauthorized":true}'