<commit_before># encoding: utf-8

# to work on both Python2 and Python3, I use u"..." but that means Python3
# must be 3.3 or later.

# this also assumes you've downloaded allkeys.txt from
# http://www.unicode.org/Public/UCA/latest/allkeys.txt

from pyuca import Collator


c = Collator("allkeys.txt")

assert sorted(["cafe", "caff", u"café"]) == ["cafe", "caff", u"café"]
assert sorted(["cafe", "caff", u"café"], key=c.sort_key) == ["cafe", u"café", "caff"]<commit_msg>coverted smoke test to use unittest<commit_after># encoding: utf-8

# to work on both Python2 and Python3, I use u"..." but that means Python3
# must be 3.3 or later.

# this also assumes you've downloaded allkeys.txt from
# http://www.unicode.org/Public/UCA/latest/allkeys.txt

from unittest import TestCase


class SmokeTest(TestCase):
    
    def test_cafe(self):
        from pyuca import Collator
        c = Collator("allkeys.txt")
        
        self.assertEqual(sorted(["cafe", "caff", u"café"]), ["cafe", "caff", u"café"])
        self.assertEqual(sorted(["cafe", "caff", u"café"], key=c.sort_key), ["cafe", u"café", "caff"])
{'fraction_non_alphanumeric': 0.16621499548328816, 'fraction_numerical': 0.01084010840108401, 'mean_word_length': 3.968609865470852, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5761256', 'n_tokens_mistral': 413, 'n_tokens_neox': 400, 'n_words': 112}