<commit_before>from cfgen import cfgen
from nose.tools import assert_equals
import os

def setup():
    test_root_dir = os.path.dirname(os.path.abspath(__file__))
    os.chdir(test_root_dir + "/test_dir")
    clean()
    

def test_cmd_write():
    cfgen.cmd_write("test.cfg")
    
    # check target file
    actual_target_lines, expected_target_lines = get_file_lines("test.cfg", "test.cfg.expected")
    assert_lines_equal(actual_target_lines, expected_target_lines)

    # check cache
    actual_cache_lines, expected_cache_lines = get_file_lines(".cfgen.cache", "cfgen.cache.expected")
    assert_lines_equal(actual_cache_lines, expected_cache_lines)

    
def clean():
    if os.path.isfile("test.cfg"):
        os.remove("test.cfg")
    if os.path.isfile(".cfgen.cache"):<commit_msg>Fix test<commit_after>from cfgen import cfgen
from nose.tools import assert_equals
import os

def setup():
    test_root_dir = os.path.dirname(os.path.abspath(__file__))
    os.chdir(test_root_dir + "/test_dir")
    clean()
    

def test_cmd_write():
    cfgen.cmd_write("test.cfg", None)
    
    # check target file
    actual_target_lines, expected_target_lines = get_file_lines("test.cfg", "test.cfg.expected")
    assert_lines_equal(actual_target_lines, expected_target_lines)

    # check cache
    actual_cache_lines, expected_cache_lines = get_file_lines(".cfgen.cache", "cfgen.cache.expected")
    assert_lines_equal(actual_cache_lines, expected_cache_lines)

    
def clean():
    if os.path.isfile("test.cfg"):
        os.remove("test.cfg")
    if os.path.isfile(".cfgen.cache"):
{'fraction_non_alphanumeric': 0.11827956989247312, 'fraction_numerical': 0.0, 'mean_word_length': 4.255813953488372, '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': '5360827', 'n_tokens_mistral': 536, 'n_tokens_neox': 535, 'n_words': 89}