<commit_before># -*- coding: utf-8 -*-
# Usage: py.test tests

import os
import pykeyvi
import shutil
import test_tools


def test_compiler_no_compile_edge_case():
    c = pykeyvi.KeyOnlyDictionaryCompiler()
    c.Add("abc")
    c.Add("abd")
    del c


def test_compiler_empty():
    c = pykeyvi.KeyOnlyDictionaryCompiler()
    with test_tools.tmp_dictionary(c, 'empty.kv') as d:
        assert len(d) == 0

def test_compiler_empty_json():
    c = pykeyvi.JsonDictionaryCompiler()
    with test_tools.tmp_dictionary(c, 'empty_json.kv') as d:
        assert len(d) == 0
<commit_msg>add another testcase for empty dictionary not compiled<commit_after># -*- coding: utf-8 -*-
# Usage: py.test tests

import os
import pykeyvi
import shutil
import test_tools


def test_compiler_no_compile_edge_case():
    c = pykeyvi.KeyOnlyDictionaryCompiler()
    c.Add("abc")
    c.Add("abd")
    del c


def test_compiler_no_compile_edge_case_empty():
    c = pykeyvi.KeyOnlyDictionaryCompiler()
    del c


def test_compiler_empty():
    c = pykeyvi.KeyOnlyDictionaryCompiler()
    with test_tools.tmp_dictionary(c, 'empty.kv') as d:
        assert len(d) == 0

def test_compiler_empty_json():
    c = pykeyvi.JsonDictionaryCompiler()
    with test_tools.tmp_dictionary(c, 'empty_json.kv') as d:
        assert len(d) == 0

{'fraction_non_alphanumeric': 0.11229946524064172, 'fraction_numerical': 0.004583651642475172, 'mean_word_length': 3.8161764705882355, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '6528395', 'n_tokens_mistral': 456, 'n_tokens_neox': 440, 'n_words': 105}