コード例 #1
0
ファイル: tests.py プロジェクト: getsentry/raven-python
 def test_bytes_max_length(self):
     x = compat.b('\xd7\xd7\xd7\xd7\xd7\xd7')
     result = transform(x, string_max_length=1)
     if compat.PY3:
         assert result == "b'\\xd7'"
     else:
         assert result == "'\\xd7'"
コード例 #2
0
ファイル: tests.py プロジェクト: zhammer/raven-python
 def test_bytes_max_length(self):
     x = compat.b('\xd7\xd7\xd7\xd7\xd7\xd7')
     result = transform(x, string_max_length=1)
     if compat.PY3:
         assert result == "b'\\xd7'"
     else:
         assert result == "'\\xd7'"
コード例 #3
0
ファイル: tests.py プロジェクト: getsentry/raven-python
    def test_recurse_exception(self):
        class NonAsciiRepr(object):
            def __repr__(self):
                return compat.b('中文')

        x = [NonAsciiRepr()]
        result = transform(x, max_depth=1)
        self.assertEqual(json.dumps(result), compat.b('["<class \'tests.utils.encoding.tests.NonAsciiRepr\'>"]'))
コード例 #4
0
ファイル: tests.py プロジェクト: zhammer/raven-python
    def test_recurse_exception(self):
        class NonAsciiRepr(object):
            def __repr__(self):
                return compat.b('中文')

        x = [NonAsciiRepr()]
        result = transform(x, max_depth=1)
        self.assertEqual(
            json.dumps(result),
            compat.b(
                '["<class \'tests.utils.encoding.tests.NonAsciiRepr\'>"]'))
コード例 #5
0
ファイル: tests.py プロジェクト: getsentry/raven-python
    def test_bad_string(self):
        x = compat.b('The following character causes problems: \xd4')

        result = transform(x)
        assert result == compat.b("'The following character causes problems: \\xd4'")
コード例 #6
0
ファイル: tests.py プロジェクト: getsentry/raven-python
    def test_string_in_python2(self):
        # 'רונית מגן'
        x = compat.b('hello world')

        result = transform(x)
        assert result == "'hello world'"
コード例 #7
0
ファイル: tests.py プロジェクト: getsentry/raven-python
 def __repr__(self):
     return compat.b('中文')
コード例 #8
0
ファイル: tests.py プロジェクト: getsentry/raven-python
    def test_incorrect_unicode(self):
        x = compat.b('רונית מגן')
        result = transform(x)

        assert result == compat.b("'רונית מגן'")
コード例 #9
0
ファイル: tests.py プロジェクト: zhammer/raven-python
    def test_bad_string(self):
        x = compat.b('The following character causes problems: \xd4')

        result = transform(x)
        assert result == compat.b(
            "'The following character causes problems: \\xd4'")
コード例 #10
0
ファイル: tests.py プロジェクト: zhammer/raven-python
    def test_string_in_python2(self):
        # 'רונית מגן'
        x = compat.b('hello world')

        result = transform(x)
        assert result == "'hello world'"
コード例 #11
0
ファイル: tests.py プロジェクト: zhammer/raven-python
 def __repr__(self):
     return compat.b('中文')
コード例 #12
0
ファイル: tests.py プロジェクト: zhammer/raven-python
    def test_incorrect_unicode(self):
        x = compat.b('רונית מגן')
        result = transform(x)

        assert result == compat.b("'רונית מגן'")