<commit_before># -*- coding: utf-8 -*-

import unittest
import oss2
import crcmod

class TestCrc64Combine(unittest.TestCase):
    def test_crc64_combine(self):
        _POLY = 0x142F0E1EBA9EA3693
        _XOROUT = 0XFFFFFFFFFFFFFFFF

        string_a = '12345'
        string_b = '67890'

        combine_fun = oss2.crc64_combine.mkCombineFun(_POLY, 0, True, _XOROUT)

        crc64_a = crcmod.Crc(_POLY, initCrc=0, xorOut=_XOROUT)
        crc64_a.update(string_a)
        crc1 = crc64_a.crcValue

        crc64_b = crcmod.Crc(_POLY, initCrc=0, xorOut=_XOROUT)
        crc64_b.update(string_b)
        crc2 = crc64_b.crcValue

        crc_combine = combine_fun(crc1, crc2, len(string_b))

        crc64_c = crcmod.Crc(_POLY, initCrc=0, xorOut=_XOROUT)
        crc64_c.update(string_a + string_b)
        crc_raw = crc64_c.crcValue
<commit_msg>fix unittests in python 3<commit_after># -*- coding: utf-8 -*-

import unittest
import oss2
import crcmod

class TestCrc64Combine(unittest.TestCase):
    def test_crc64_combine(self):
        _POLY = 0x142F0E1EBA9EA3693
        _XOROUT = 0XFFFFFFFFFFFFFFFF

        string_a = oss2.to_bytes('12345')
        string_b = oss2.to_bytes('67890')

        combine_fun = oss2.crc64_combine.mkCombineFun(_POLY, 0, True, _XOROUT)

        crc64_a = crcmod.Crc(_POLY, initCrc=0, xorOut=_XOROUT)
        crc64_a.update(string_a)
        crc1 = crc64_a.crcValue

        crc64_b = crcmod.Crc(_POLY, initCrc=0, xorOut=_XOROUT)
        crc64_b.update(string_b)
        crc2 = crc64_b.crcValue

        crc_combine = combine_fun(crc1, crc2, len(string_b))

        crc64_c = crcmod.Crc(_POLY, initCrc=0, xorOut=_XOROUT)
        crc64_c.update(string_a + string_b)
        crc_raw = crc64_c.crcValue

{'fraction_non_alphanumeric': 0.09837962962962964, 'fraction_numerical': 0.06770833333333333, 'mean_word_length': 2.938496583143508, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2863885', 'n_tokens_mistral': 806, 'n_tokens_neox': 738, 'n_words': 108}