コード例 #1
0
    def test_boundary_cases(self):
        ss = b'\x00' * 15 + b'\xe2\x80\x80'
        result, bytestring = _utf8_check(ss)
        assert self.check(bytestring) == result

        ss = b'\x00' * 13 + b'\xf2\x80\x80\x80'
        result, bytestring = _utf8_check(ss)
        assert self.check(bytestring) == result

        ss = b'\x00' * 14 + b'\xe2\x80\x80'
        result, bytestring = _utf8_check(ss)
        assert self.check(bytestring) == result
コード例 #2
0
ファイル: test_u8u16.py プロジェクト: pypy/fast-utf8-methods
 def test_u8u16(self, data):
     for path in self.test_files:
         with open(path, 'rb') as fd:
             bytestring = fd.read()
             a = data.draw(
                 st.integers(min_value=0, max_value=len(bytestring)))
             b = data.draw(
                 st.integers(min_value=a, max_value=len(bytestring)))
             result, bytestring = _utf8_check(bytestring[a:b])
             assert self.check(bytestring) == result
コード例 #3
0
 def test_special_cases(self):
     ss = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc2\x81\x00\x00'
     result, bytestring = _utf8_check(ss)
     assert self.check(bytestring) == result
コード例 #4
0
 def test_check_correct_utf8_minsize_32(self, bytestring):
     result, bytestring = _utf8_check(bytestring)
     assert self.check(bytestring) == result
コード例 #5
0
 def test_check_correct_utf8_fast(self, bytestring):
     result, bytestring = _utf8_check(bytestring)
     assert self.check(bytestring) == result