本文整理汇总了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}'