當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。