<commit_before>from hashids import Hashids
import pytest

class TestConstructor(object):
    def test_small_alphabet(self):
        pytest.raises(ValueError, Hashids, alphabet='abcabc')


class TestEncryption(object):
    def test_empty_call(self):
        assert Hashids().encrypt() == ''

    def test_default_salt(self):
        assert Hashids().encrypt(1, 2, 3) == 'katKSA'

    def test_single_number(self):
        h = Hashids()
        assert h.encrypt(12345) == 'rGAx'
        assert h.encrypt(1) == 'yE'
        assert h.encrypt(22) == 'B8'
        assert h.encrypt(333) == '7G9'
        assert h.encrypt(9999) == 'zpz5'

    def test_multiple_numbers(self):
        h = Hashids()
        assert h.encrypt(683, 94108, 123, 5) == '6nph8p9duq8u9'
        assert h.encrypt(1, 2, 3) == 'katKSA'
        assert h.encrypt(2, 4, 6) == '5jhof9'
        assert h.encrypt(99, 25) == 'nq4CG'

    def test_salt(self):
        h = Hashids(salt='Arbitrary string')
        assert h.encrypt(683, 94108, 123, 5) == 'q9khp7X9u6BuE'
        assert h.encrypt(1, 2, 3) == 'a7tLSG'
        assert h.encrypt(2, 4, 6) == 'Xbh4fp'
        assert h.encrypt(99, 25) == 'K6nCz'

    def test_alphabet(self):
        h = Hashids(alphabet='!"#%&\',-/0123456789:;<=>ABCDEFGHIJKLMNOPQRSTUVWXYZ_`abcdefghijklmnopqrstuvwxyz~')
        assert h.encrypt(2839, 12, 32, 5) == '!%u#Y=%#v'
        assert h.encrypt(1, 2, 3) == ':Y9c#2'
        assert h.encrypt(23832) == 'cZKL'
        assert h.encrypt(99, 25) == 'aNCEI'

    def test_min_length(self):
        h = Hashids(min_length=25)
        assert h.encrypt(7452, 2967, 21401) == '4ARhAecbrrGh8K7FBBbi4nkhL'
        assert h.encrypt(1, 2, 3) == 'IeRX9XtbpTkatKSAcXe4tALde'
        assert h.encrypt(6097) == 'aULxKgxFpEi7prdcK7LFLz4Lk'
        assert h.encrypt(99, 25) == 'UrBa8pCqLTnq4CGTaMpC7Kj6x'

    def test_all_parameters(self):
        h = Hashids('arbitrary salt', 16, 'abcdefghijklmnopqrstuvwxyz')
        assert h.encrypt(7452, 2967, 21401) == 'mjpnilkonugzfjub'
        assert h.encrypt(1, 2, 3) == 'nqyjbjpcfeymvfiq'
        assert h.encrypt(60125) == 'vxwfjmrnfvtmpdow'
        assert h.encrypt(99, 25) == 'hsnymlyueozbnijs'

    def test_negative_call(self):
        assert Hashids().encrypt(1, -2, 3) == ''

    def test_float_call(self):
        assert Hashids().encrypt(1, 2.5, 3) == ''

class TestDecryption(object):
    def test_empty_string(self):
        assert Hashids().decrypt('') == ()

    def test_non_string(self):
        assert Hashids().decrypt(object()) == ()

    def test_default_salt(self):
        assert Hashids().decrypt('katKSA') == (1, 2, 3)

    def test_empty_call(self):
        assert Hashids().decrypt('') == ()

    def test_single_number(self):
        h = Hashids()
        assert h.decrypt('rGAx') == (12345,)<commit_msg>Update tests to match results from hashids.js 0.3.x<commit_after>from hashids import Hashids
import pytest

class TestConstructor(object):
    def test_small_alphabet(self):
        pytest.raises(ValueError, Hashids, alphabet='abcabc')


class TestEncryption(object):
    def test_empty_call(self):
        assert Hashids().encrypt() == ''

    def test_default_salt(self):
        assert Hashids().encrypt(1, 2, 3) == 'o2fXhV'

    def test_single_number(self):
        h = Hashids()
        assert h.encrypt(12345) == 'j0gW'
        assert h.encrypt(1) == 'jR'
        assert h.encrypt(22) == 'Lw'
        assert h.encrypt(333) == 'Z0E'
        assert h.encrypt(9999) == 'w0rR'

    def test_multiple_numbers(self):
        h = Hashids()
        assert h.encrypt(683, 94108, 123, 5) == 'vJvi7On9cXGtD'
        assert h.encrypt(1, 2, 3) == 'o2fXhV'
        assert h.encrypt(2, 4, 6) == 'xGhmsW'
        assert h.encrypt(99, 25) == '3lKfD'

    def test_salt(self):
        h = Hashids(salt='Arbitrary string')
        assert h.encrypt(683, 94108, 123, 5) == 'QWyf8yboH7KT2'
        assert h.encrypt(1, 2, 3) == 'neHrCa'
        assert h.encrypt(2, 4, 6) == 'LRCgf2'
        assert h.encrypt(99, 25) == 'JOMh1'

    def test_alphabet(self):
        h = Hashids(alphabet='!"#%&\',-/0123456789:;<=>ABCDEFGHIJKLMNOPQRSTUVWXYZ_`abcdefghijklmnopqrstuvwxyz~')
        assert h.encrypt(2839, 12, 32, 5) == '_nJUNTVU3'
        assert h.encrypt(1, 2, 3) == '7xfYh2'
        assert h.encrypt(23832) == 'Z6R>'
        assert h.encrypt(99, 25) == 'AYyIB'

    def test_min_length(self):
        h = Hashids(min_length=25)
        assert h.encrypt(7452, 2967, 21401) == 'pO3K69b86jzc6krI416enr2B5'
        assert h.encrypt(1, 2, 3) == 'gyOwl4B97bo2fXhVaDR0Znjrq'
        assert h.encrypt(6097) == 'Nz7x3VXyMYerRmWeOBQn6LlRG'
        assert h.encrypt(99, 25) == 'k91nqP3RBe3lKfDaLJrvy8XjV'

    def test_all_parameters(self):
        h = Hashids('arbitrary salt', 16, 'abcdefghijklmnopqrstuvwxyz')
        assert h.encrypt(7452, 2967, 21401) == 'wygqxeunkatjgkrw'
        assert h.encrypt(1, 2, 3) == 'pnovxlaxuriowydb'
        assert h.encrypt(60125) == 'jkbgxljrjxmlaonp'
        assert h.encrypt(99, 25) == 'erdjpwrgouoxlvbx'


    def test_negative_call(self):
        assert Hashids().encrypt(1, -2, 3) == ''

    def test_float_call(self):
        assert Hashids().encrypt(1, 2.5, 3) == ''

class TestDecryption(object):
    def test_empty_string(self):
        assert Hashids().decrypt('') == ()

    def test_non_string(self):
        assert Hashids().decrypt(object()) == ()

    def test_default_salt(self):
        assert Hashids().decrypt('katKSA') == (1, 2, 3)

    def test_empty_call(self):
        assert Hashids().decrypt('') == ()

    def test_single_number(self):
        h = Hashids()
        assert h.decrypt('rGAx') == (12345,)
{'fraction_non_alphanumeric': 0.15338185691461034, 'fraction_numerical': 0.07083259364459435, 'mean_word_length': 2.9676056338028167, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, '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': '4292916', 'n_tokens_mistral': 2531, 'n_tokens_neox': 2226, 'n_words': 408}