当前位置: 首页>>代码示例>>Python>>正文


Python SingleException.to_python方法代码示例

本文整理汇总了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',
     ))
开发者ID:duanshuaimin,项目名称:sentry,代码行数:9,代码来源:test_exception.py

示例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"
开发者ID:pombredanne,项目名称:django-sentry,代码行数:10,代码来源:test_exception.py

示例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'
开发者ID:duanshuaimin,项目名称:sentry,代码行数:14,代码来源:test_exception.py

示例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}'
开发者ID:hosmelq,项目名称:sentry,代码行数:15,代码来源:test_exception.py

示例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
开发者ID:duanshuaimin,项目名称:sentry,代码行数:9,代码来源:test_exception.py

示例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',
         )
     )
开发者ID:alshopov,项目名称:sentry,代码行数:10,代码来源:test_exception.py

示例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}'
开发者ID:duanshuaimin,项目名称:sentry,代码行数:8,代码来源:test_exception.py

示例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"))
开发者ID:Getsidecar,项目名称:sentry,代码行数:4,代码来源:test_exception.py

示例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
开发者ID:AyrtonRicardo,项目名称:sentry,代码行数:5,代码来源:test_exception.py

示例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}'
开发者ID:hosmelq,项目名称:sentry,代码行数:8,代码来源:test_exception.py


注:本文中的sentry.interfaces.exception.SingleException.to_python方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。